iphone - 如何在iPhone应用程序的表格单元格中加载背景图像

标签 iphone objective-c iphone-sdk-3.0 uitableview

我开发了一个 RSS 应用程序。在我的表格单元格中,我显示从 RSS 提要和标题中的图像链接检索到的图像。 图像已成功加载,但问题是它挂起了我的应用程序。 因为有任何方法可以在后台加载图像。 我当前的代码是。

int blogEntryIndex1 = [indexPath indexAtPosition: [indexPath length] -1];
        imgstring=[[blogEntries objectAtIndex: blogEntryIndex1] objectForKey: @"image"];
NSURL *url = [NSURL URLWithString:imgstring];
    NSData *data = [NSData dataWithContentsOfURL:url];
    UIImage *img = [[UIImage alloc] initWithData:data];
     cell.imageView.image=[img autorelease];

请有任何想法,提前致谢...

最佳答案

重新发布...您还应该通过 Apple 的示例代码查看延迟表加载 http://developer.apple.com/iphone/library/samplecode/LazyTableImages/Introduction/Intro.html

更新此处的另一个示例:http://www.markj.net/iphone-asynchronous-table-image/

关于iphone - 如何在iPhone应用程序的表格单元格中加载背景图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3213046/

相关文章:

iphone - 获取 StartDate 和 EndDate 之间的日期

iphone - iPhone 应用程序中的 Windows Live 身份验证

ios - 如何在WKWebview上添加UIButton?

iphone - ffmpeg 用于从 iPhone 摄像机中提取帧

iphone - 收到推送通知时如何判断我的 iPhone 应用程序是否正在运行?

iphone - 关闭屏幕播放声音/不要让 iPhone 进入休眠状态

iphone - NSConcreteData 与 NSData

ios - iOS 7 中 UITableView 的 contentInset 规则?

iphone - 如何通过在iphone中编程找到UUID?

iphone - 创建自定义 UIScrollView 滚动器