嗨,我正在使用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