0
我用下面的代碼來縮放圖像到我的UIImageView。桌子第一次加載時一切都很好。但是當我滾動tableview時,所有的圖像方面都被打破了。的UIImageView看點不適合工作時的tableview滾動
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ProductCell" forIndexPath:indexPath];
[self configureCustomCell:(ProductsTableViewCell*)cell atIndexPath:indexPath];
return cell;
}
- (void)configureCustomCell:(ProductsTableViewCell*)cell atIndexPath:(NSIndexPath *)indexPath {
NSURL *url = [NSURL URLWithString:[[arr_products objectAtIndex:indexPath.section] productImage]];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
__weak UITableViewCell *weakCell = cell;
[cell.productPhotoImage setImageWithURLRequest:request placeholderImage:nil
success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) {
weakCell.imageView.image = image;
weakCell.imageView.contentMode = UIViewContentModeScaleAspectFit;
weakCell.imageView.clipsToBounds = YES;
weakCell.imageView.frame = CGRectMake(5, 5, 60, 60);
}
failure:nil];
}
請在' - tableView:cellForRowAtIndexPath:'中顯示你的代碼。 – KudoCC
@serdar aylanc是你使用自定義單元? – satheesh
@satheesh我更新了問題中的代碼 –