我有一個數組,其中有一個內容圖像的URL「Image」。我想在我的表格視圖中顯示該圖像。 如何做。請給我建議。解析Iphone中的圖像問題
0
A
回答
0
img_view = [[UIImageView alloc]init];
img_view.autoresizingMask = UIViewAutoresizingFlexibleWidth;
img_view.frame = CGRectMake(0,0,130, 75);
activityIndicator = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge] autorelease];
[img_view addSubview: activityIndicator];
activityIndicator.center = CGPointMake(50,30);
NSOperationQueue *queue = [NSOperationQueue new];
NSInvocationOperation *operation = [[NSInvocationOperation alloc]
initWithTarget:self
selector:@selector(loadImage:)
object:[[xmlParser data1] objectAtIndex:indexPath.row]];
[queue addOperation:operation];
[operation release];
[cell.contentView addSubview:img_view];
-(void)loadImage:(Book *)book
{
[activityIndicator startAnimating];
NSString *imgurl=[book image_url];
NSURL *url=[[NSURL alloc]initWithString:imgurl];
NSData *img=[[NSData alloc]initWithContentsOfURL:url];
UIImage *image=[UIImage imageWithData:img];
img_view.image=image;
[activityIndicator stopAnimating];
}
+0
如果你想要更多的幫助請求 – 2012-03-01 05:18:18
+0
你能給我發送樣本代碼嗎? – 2012-03-01 23:19:38
+0
這是更多的示例代碼 – 2012-03-02 04:11:35
1
您可以在谷歌搜索使用「懶加載圖像的tableview」。
它也適用於蘋果的例子。
相關問題
- 1. Http圖像解析問題
- 2. iphone中的圖像問題
- 3. Android/iPhone圖像解析
- 4. json解析iphone sdk問題?
- 5. iphone JSON解析objectForKey問題
- 6. iphone xml解析問題
- 7. iPhone json解析問題
- 8. xml解析iphone問題
- 9. iPhone XML解析問題
- 10. Libxml解析器iphone問題
- 11. 如何在iphone中解析此問題
- 12. iPhone上的圖像問題
- 13. 關於從圖像標記解析圖像url的問題
- 14. iPhone SDK:解析JSON的問題
- 15. iPhone中的圖像緩存問題
- 16. 圖像對齊問題 - iPhone
- 17. 解析肥皂響應問題(iphone/touchxml)
- 18. iPhone:解析響應字典問題:
- 19. iPhone SDK - 問題從RSS源解析XML
- 20. 解析中的問題
- 21. 解析問題
- 22. 問題解析
- 23. 解析問題!
- 24. Android:解碼位圖圖像的問題
- 25. 問題在加載圖像... iPhone的Xcode
- 26. iphone - uitextview的背景圖像問題
- 27. 問題在分配圖像的UIImageView iPhone
- 28. 與圖像點擊問題iphone的UIButton
- 29. iPhone:從問題調整的UIImagePickerController圖像
- 30. GsonRequest有解析地圖的問題
放置活動指示器直到它下載加載 – 2012-03-01 05:15:14
UItablView和NSMutableArray,NSMusicDirectory也從Apple文檔讀取「https://github.com/rs/SDWebImage」 – 2012-03-01 05:18:47
看看這個鏈接..... panagtakdo.com/文件/ MyAsynchronousImageLoader/MyAsynchronousImageLoader.zip – Narayana 2012-03-01 05:20:21