編輯:UIViewContentModeScale模式觸摸(高亮)
我得到創建一個定製電池解決了該問題(然而,還有另外questions)但是,爲什麼默認的單元格不工作仍然是一個謎...
科裏的答案沒有解決這個問題,但clipsToBounds
真的是一個點,我讚賞他的持續幫助。所以我給他賞金,但不接受他的答案作爲答案。在風中,答案還是....
================================
我將單元格圖像的UIViewContentModeScale
模式設置爲AspectFill
(左圖),並且圖像正確顯示(填充圖像視圖但保留方面)。但是,在觸摸並按住單元格之後,圖像會發生變化:imageView的框架和contentViewMode會更改。 (請參閱下面左圖中的第一個單元格)
這是真的有線,我可以相信,如基本的東西可能會出錯,所以一定有一些東西我錯過了。
環境:Xcode 4.3 iOS5.1模擬器&設備。
更新:
我設置使用故事板的檢查員的UIViewContentMode。
順便說一句,我用SDWebImage/UIImageView + WebCache.h。
UPDATE2:
我明確設置內容模式的代碼,但問題仍然存在。 [cell.imageView setContentMode:UIViewContentModeScaleAspectFill];
UPDATE4:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"AlbumCell"];
if(cell == nil){
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"AlbumCell"];
}
//[cell.imageView setContentMode:UIViewContentModeScaleAspectFill];
//[cell.imageView setClipsToBounds:YES];
[self configureCell:cell atIndexPath:indexPath];
return cell;
}
- (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath
{
Album *album = [self.fetchedResultsController objectAtIndexPath:indexPath];
cell.textLabel.text = [album.title description];
cell.detailTextLabel.text = [self.userVisiableDateFormatter stringFromDate:album.releaseDate];
//[cell.imageView setContentMode:UIViewContentModeScaleAspectFill];
[cell.imageView setImageWithURL:[NSURL URLWithString:album.coverThumbnailUrl]
placeholderImage:[self placeHolderImage]];
}
用什麼方法設置內容模式?告訴我們該方法的來源。 – 2012-07-25 04:06:55
@rob我使用故事板中的歸屬檢查器設置歸因。 – pierrotlefou 2012-07-26 08:47:27
嘗試使用scaleToFill內容模式 – Mrunal 2012-07-26 09:41:25