【发布时间】:2011-10-21 10:31:17
【问题描述】:
我是新的 i 手机开发人员,我正在努力解决一个问题,我在我的应用程序中使用了通过 Web 服务捕获的图像。我的问题是放置在每个表格单元格上的每个图像,我以我的单元格大小压缩了该图像大小,但图像清晰度缺失。请告诉我如何清晰地设置单元格中的图像。
我很受这个问题的困扰,请给我任何建议。
您好,我正在使用 Twitter,我的图片有问题,我的推文视图有 UITableview,它包含所有带有用户照片的推文,如果我在滚动 UITableview 时将这些照片加载到每个单元格中,它会滚动非常非常缓慢请建议我减少照片的内存大小并快速滚动 UITableView。
我听说缩略图可以减少内存大小,是吗?(如果不是,我必须选择哪种方法以及缩略图方法做什么)如果是这样,如何在此代码中执行此操作(表格视图单元格代码) 我听说缩略图可以减少内存大小,是吗?(如果不是,我必须选择哪种方法以及缩略图方法是什么)如果是这样,如何在此代码中执行此操作(表格视图单元格代码)
- (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;
}
Thanks in advance.
【问题讨论】:
标签: iphone ios image uiimageview