由於我是新的iPad應用程序開發請幫助我簡單的問題。
我想在服務器的tableview中顯示圖像。它顯示正確。
但是,當我滾動表上升,再次回到那裏,它會再次從服務器下載圖像數據。
請幫幫我。NSOperation執行uitableview細胞圖像
編輯:
的tableView:的cellForRowAtIndexPath:
static NSString *CellIdentifier = @"cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
[cell setSelectionStyle:UITableViewCellSelectionStyleBlue];
UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 1024, 75)];
[imgView setImage:[UIImage imageNamed:@"strip_normal.png"]];
[imgView setHighlightedImage:[UIImage imageNamed:@"strip_hover.png"]];
[cell addSubview:imgView];
[imgView release];
UIImageView *imgView1 = [[UIImageView alloc] initWithFrame:CGRectMake(5, 5, 64, 64)];
imgView1.tag = indexPath.row;
UIImage *img = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://www.abc.com/abc/%@.png", [[arrMyCourses objectAtIndex:indexPath.row] valueForKey:@"CourseNumber"]]]]];
[imgView1 setImage:img];
[cell addSubview:imgView1];
[imgView1 release];
return cell;
在此先感謝。
你現在怎麼實現你的'tableView:cellForRowAtIndexPath:'? – 2011-06-02 14:22:17
@Deepak,請參閱我編輯的問題。 – 2011-06-03 04:58:34