简体   繁体   English

MGTwitterEngine-在iPhone上使用getImageAtURL

[英]MGTwitterEngine - Using getImageAtURL on iPhone

Essentially, I'm working on asynchronously downloading images and adding them to specific UITableView cells (twitter profile images using MGTwitterEngine from Matt Gemmell). 本质上,我正在异步下载图像并将其添加到特定的UITableView单元中(使用Matt Gemmell的MGTwitterEngine的Twitter个人资料图像)。

I've looked at general asynchronous download code and must admit, I'm still too much of a noob to understand it well enough to adapt it to my purposes. 我已经看过一般的异步下载代码,必须承认,我仍然是一个菜鸟,对它足够了解,无法适应我的目的。 Instead, I'm attempting to use Gemmell's included getImageAtUrl method to add the images. 相反,我尝试使用Gemmell包含的getImageAtUrl方法添加图像。

I have it working to the point that -imageReceived: receives the images for visible cells, however, I'm stuck as to how to include them into the appropriate cells at that point. 我的工作到了-imageReceived:接收可见单元格的图像,但是,我仍然坚持如何将它们包括在适当的单元格中。

    - (void)imageReceived:(UIImage *)image forRequest:(NSString *)identifier
{
    NSLog(@"Got an image:%@",image);
    // What goes here? Or elsewhere?
}

This method is within my main view controller, I also have a custom cell controller where I'm drawing the cell content using Loren Brichter's fast scrolling code . 该方法在我的主视图控制器中,我还有一个自定义单元格控制器,使用Loren Brichter的快速滚动代码在其中绘制单元格内容。

Any help with this MGTwitterEngine method in particular, or with dynamically adding these images to my table cells would be greatly appreciated. 特别是对于此MGTwitterEngine方法的任何帮助,或将这些图像动态添加到我的表格单元格中的任何帮助,将不胜感激。

I've never used MGTwitterEngine, but in general I'd assume you need to: 我从未使用过MGTwitterEngine,但总的来说,我认为您需要:

  1. Figure out which model object the image belongs to. 找出图像属于哪个模型对象。 I assume the identifier string will help you there. 我认为identifier字符串会在这里为您提供帮助。

  2. Figure out the index path of the corresponding cell. 找出相应单元格的索引路径。

  3. Call [tableView cellForRowAtIndexPath:indexPath] to get the table cell. 调用[tableView cellForRowAtIndexPath:indexPath]以获取表格单元格。

  4. Put the image into the cell. image放入单元格。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM