我有一個從我的Url加載圖像的TableView,一切都很好。問題是當我向下或向上滾動時,圖像在單元格中變大。有時它變得比它自己的細胞更大。表格查看特定大小的細胞圖像
我已經嘗試了所有的東西,但它不工作,我坐在視圖模式,以適應方面,但仍然有同樣的問題。
她是我的代碼:
static NSString *cellIdentifier = @"Cell";
CellView *cell = [self.tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];
if (!cell) {
cell = [[CellView alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];
}
ListOfObjects *listObjects;
cell.accessoryType = UITableViewCellAccessoryNone;
listObjects = [listArray objectAtIndex:indexPath.row];
cell.userName.text = userName;
ListOfObjects *venue = ((ListOfObjects *)self.listArray[indexPath.row]);
NSString *one = listObjects.theUserId;
NSURL *myUrl = [NSURL URLWithString:one];
if (listObjects.image) {
cell.imageView.image = listObjects.image;
} else {
// set default user image while image is being downloaded
cell.imageView.image = [UIImage imageNamed:@"second58.png"];
// download the image asynchronously
[self downloadImageWithURL:myUrl completionBlock:^(BOOL succeeded, UIImage *image) {
if (succeeded) {
// change the image in the cell
cell.imageView.image = image;
// cache the image for use later (when scrolling up)
venue.image = image;
}
}];
}
任何一個可以給我一個關於它的想法?
添加代碼,其中的邏輯是有 – 2014-10-20 04:15:19
你可以發佈圖片的問題?你是什麼意思,他們比單元格更大?它們是否放大或溢出視圖?檢查cellView上的contentView,然後檢查heightForRow以及tableView自身的寬度,看看它是否適用於您的圖像 – noobsmcgoobs 2014-10-20 05:07:11
圖像溢出了單元格,不幸的是我無法發佈圖像,因爲我是新用戶。讓我們說原始圖像幀大小(40 * 40),從我的網址加載表後,向下滾動圖像變大,讓我們說(100 * 100) – 2014-10-20 05:19:43