嗨,我正在使用Twitter,我得到的圖片有問題,我有推文視圖有UITableview,它包含與用戶照片的所有推文,如果我加載這些照片在每個單元格當我滾動UITableview,它滾動非常非常緩慢請建議我減少照片的內存大小和快速滾動UITableView。iPhone:如何減少圖片的內存大小
聽說縮略圖可以降低內存的大小,不是。(如果不是我要選擇什麼縮略圖方法做的哪一種方法),如果是的話怎麼辦,在該代碼(表視圖單元代碼)
//Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *identifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
if(!cell) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewStyleGrouped reuseIdentifier:nil] autorelease];
UIImageView *myImage = [[UIImageView alloc]initWithFrame:CGRectMake(6,10,58,60)] ;
NSURL *url = [NSURL URLWithString:[(Tweet*)[tweetArray objectAtIndex:indexPath.row] image_url]]; //here Tweet is other class and image_url is method in the Tweet class
NSData *data = [[NSData alloc] initWithContentsOfURL:url];
[myImage setImage: [UIImage imageWithData:data]];
[cell.contentView addSubview:myImage];
[myImage release];
}
return cell;
}
謝謝
請建議我
請編輯您的帖子突出的代碼。這是不可能的。 – 2011-02-03 12:15:34