更新后图像变小

时间:2017-02-24 19:58:43

标签: ios objective-c uiimageview uiimage

我用50x50大小的UIImageView对象创建了一个自定义单元格。 当我启动应用程序并从服务器下载相同大小的图像时,所有这些图像都显示正确的大小。 但后来我在单元格中点击或滚动单元格开始更新,所有图片变小。我究竟做错了什么? 占位符的大小也是50x50,更新后它们的大小正确。



- (UITableViewCell *)tableView:(UITableView *)tableView 
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
static NSString *identifier = @"NTFriendsListCellID";
    
NTFriendsListCell *cell = 
[self.tableView dequeueReusableCellWithIdentifier:identifier];
    
UIActivityIndicatorView *activityIndicator = 
[[UIActivityIndicatorView alloc] initWithFrame:cell.photoView.bounds];
    
NTFriend *friend = [self.friends objectAtIndex:indexPath.row];
    
__weak UITableViewCell *weakCell = cell;
    
[cell.imageView setImageWithURLRequest:friend.photoURLRequest
               
      placeholderImage:[UIImage imageNamed:@"unknown.png"]
               
      success:^(NSURLRequest * _Nonnull request, 
      NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull image) {
               
               weakCell.imageView.image = image;
               
      }
      failure:nil   
];
     
return cell;




更新前的屏幕截图:

Before update

更新后的屏幕截图:

After update

0 个答案:

没有答案