2011-03-09 40 views
1

在我的iPhone应用程序中,我有一个UITabelview通过URL填充数据。当我从UITableview中选择一个单元格时,它会调用URL并下载图像并传递给另一个UITableview。当我单击单元格时,需要一段时间才能加载图像并保持单击UITableviewcell。我有以下代码调用URL并在每个单元格调用中加载图像。从UIImageView的UIActivityIndi​​catorView的URL加载图像

if (!cell) { 
     cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"imageCell"] autorelease]; 
     imageView1 = [[cell subviews] lastObject]; 
     [cell addSubview:imageView1 ]; 
} 

NSString fileName = image.Img; 
NSString *filePath= [NSString stringWithFormat:@"http://www.abc.com/xml/id=12345",fileName]; 

UIImage *im = [UIImage imageWithData: [NSData dataWithContentsOfURL:[NSURL URLWithString:filePath]]]; 
subview = [[UIImageView alloc] initWithFrame:CGRectMake(120.0f, 10.0f,60.0f, 60.0f)] ; 
[subview setImage:im]; 
[subview setContentMode:UIViewContentModeScaleToFill]; 
[cell.contentView addSubview:subview]; 

我看到其中的个人资料相片是越来越下载并在它的数据UIActivityIndi​​cator加载几个应用程序。我想以相同的方式在UIImageView上使用UIActivityIndi​​cator。任何人都可以帮助我在uiimageview上实现uiactivityindicator。

回答

0
+0

感谢您的搜索。但我还有一个担心,一旦数据被下载,我应该如何在详细视图控制器页面上显示它。我已经使用这个代码背后的逻辑:https://github.com/slatvick/Alterplay-iPhone-dev-tips/blob/gh-pages/AsyncImage/AsynchronousImageView.m – lifemoveson 2011-03-09 23:18:38

相关问题