我开发了一个 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/