成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

iPhone Table中實現(xiàn)動態(tài)加載圖片教程

移動開發(fā) iOS
本文介紹的是iPhone Table中實現(xiàn)動態(tài)加載圖片教程,很詳細(xì)的為友們介紹,我們先來看內(nèi)容。

iPhone Table中實現(xiàn)動態(tài)加載圖片教程是本文要介紹的,主要是以代碼實現(xiàn)內(nèi)容,我們來看內(nèi)容。

iPhone Table中實現(xiàn)動態(tài)加載圖片教程

iPhone在加載列表時,如果每個等待把所有列表中的數(shù)據(jù)都加載完在顯示相關(guān)內(nèi)容,如果列表中有一些比較大的圖片,加載的時間比較長,那么給用戶的效果就很差了,下面詳細(xì)是一種實現(xiàn)動態(tài)加載圖片的辦法:

  1. - (UITableViewCell *)tableView:(UITableView *)tableView   
  2.          cellForRowAtIndexPath:(NSIndexPath *)indexPath {   
  3.     UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:@"tag"];   
  4.     if (cell==nil) {   
  5.         cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle   
  6.                                        reuseIdentifier:@"tag"] autorelease];   
  7.     }      
  8.     //表格設(shè)計   
  9.     NSDictionary* one = [array objectAtIndex:indexPath.row];   
  10.     cell.textLabel.text = [one objectForKey:@"title"];   
  11.     cell.detailTextLabel.text = [one objectForKey:@"content"];   
  12.      [NSThread detachNewThreadSelector:@selector(updateImageForCellAtIndexPath:) toTarget:self withObject:indexPath];   
  13.     return cell;   
  14. }  
  15.  
  16. - (void)updateImageForCellAtIndexPath:(NSIndexPath *)indexPath   
  17. {   
  18.     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];   
  19.     UIImage *image = [self getImageForCellAtIndexPath:indexPath];   
  20.     UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];   
  21.     [cell.imageView performSelectorOnMainThread:@selector(setImage:) withObject:image waitUntilDone:NO];   
  22.     [image release];   
  23.     [pool release];   
  24. }   
  25. -(UIImage *)getImageForCellAtIndexPath:(NSIndexPath *)indexPath   
  26. {   
  27.     id path = [[array objectAtIndex:indexPath.row] objectForKey:@"image"];   
  28.     NSURL *url = [NSURL URLWithString:path];   
  29.     NSData *data = [NSData dataWithContentsOfURL:url];   
  30.     UIImage *image = [[UIImage alloc] initWithData:data cache:NO];   
  31.     return image;   

源代碼:http://easymorse-iphone.googlecode.com/svn/trunk/WelcomePavilion/

小結(jié):iPhone Table中實現(xiàn)動態(tài)加載圖片教程的內(nèi)容介紹完了,希望本文對你有所幫助。

責(zé)任編輯:zhaolei 來源: 互聯(lián)網(wǎng)
相關(guān)推薦

2011-07-21 17:35:11

iPhone Table 圖片

2011-07-06 16:15:46

iPhone 圖片

2011-08-12 18:18:03

iPhone開發(fā)UIPageContr按鈕

2011-07-08 15:08:16

iPhone 圖片

2011-07-28 10:26:18

2013-06-27 11:16:27

Android異步加載

2011-07-22 13:30:52

JavaScript

2009-08-28 16:14:26

C#實現(xiàn)加載動態(tài)庫

2011-08-05 16:31:47

iPhone 數(shù)據(jù)庫

2011-08-22 10:31:40

iPhone開發(fā)BSD Socket

2011-08-15 13:44:07

iPhone開發(fā)UITableView

2011-08-05 16:10:31

iPhone 網(wǎng)絡(luò) NSURLConne

2011-08-09 10:05:57

TableView服務(wù)器圖片

2011-07-27 17:07:06

iPhone 游戲 Cocos2d

2011-07-21 16:48:19

iPhone 游戲

2011-08-10 15:48:10

iPhone網(wǎng)絡(luò)

2011-08-12 13:19:24

iPhoneSDK安裝

2011-08-18 17:32:55

iPhone開發(fā)Table Cell

2011-08-19 17:02:46

iPhone開發(fā)

2011-07-26 14:18:20

點贊
收藏

51CTO技術(shù)棧公眾號

主站蜘蛛池模板: 国产丝袜一区二区三区免费视频 | 婷婷色网 | 亚洲第一av | 日本一区二区高清视频 | 中文字幕第一页在线 | 国产区在线看 | 一区二区三区四区电影视频在线观看 | 欧美视频一区二区三区 | www.47久久青青| 在线视频一区二区三区 | 亚洲 中文 欧美 日韩 在线观看 | 国产精品色av | 日韩av在线一区二区三区 | 成人在线视频网 | jlzzjlzz国产精品久久 | 性色综合 | 中文福利视频 | 久久久久久久一区 | 久久中文字幕一区 | 亚洲一区二区三区在线播放 | 国产亚洲成av人在线观看导航 | 中文字幕日韩欧美 | 国产剧情一区 | 九九久久免费视频 | 精品一区二区久久久久久久网站 | 美女久久 | 婷婷在线免费 | 国产一区二区三区久久久久久久久 | 看黄在线 | 国产中文视频 | 亚洲一二三视频 | 91精品国产91久久久久久吃药 | 免费日韩网站 | 在线国产视频 | 国产亚洲精品精品国产亚洲综合 | 尤物在线视频 | 久久久久国产精品午夜一区 | 亚洲成人高清 | 国产一区欧美一区 | 欧美13videosex性极品 | 国产精品久久久久久久久久久免费看 |