我正在开发一个应用程序,其中包含显示照片相册列表的一些功能。我使用了原始的
在选择后,单元格的imageView框架为:
我没有涉及任何代码,这只是一个原始的UITableViewCell。
为什么会发生这种情况?我该如何停止它?
UITableView
和原始的UITableViewCell
s。我使用了Subtitle
风格的UITableViewCell
,并在cell.imageView.image
上设置了缩略图。注意:这不是自定义单元格,而是内置单元格imageView。
问题在于,当我点击一个单元格时,imageView会变大,这看起来很奇怪,因为a)这不是直观的行为,b)它不再与其他每一行匹配。
在选择之前,单元格的imageView框架如下:
cell.imageView.frame: {{16, 1}, {84, 84}}
在选择后,单元格的imageView框架为:
cell.imageView.frame: {{16, 0}, {88, 87.5}}
我没有涉及任何代码,这只是一个原始的UITableViewCell。
我唯一与imageView互动的代码是PhotoKit代码,用于获取照片资源并更新单元格:
PHImageRequestOptions *options = [[PHImageRequestOptions alloc] init];
options.resizeMode = PHImageRequestOptionsResizeModeExact;
[self.imageManager requestImageForAsset:asset
targetSize:AssetGridThumbnailSize
contentMode:PHImageContentModeAspectFill
options:options
resultHandler:^(UIImage *result, NSDictionary *info) {
// Only update the thumbnail if the cell tag hasn't changed.
// Otherwise, the cell has been re-used.
if (cell.tag == currentTag) {
cell.imageView.contentMode = UIViewContentModeScaleAspectFill;
cell.imageView.image = result;
}
}];
为什么会发生这种情况?我该如何停止它?
heightForRowAtIndex:
方法返回的值比cell的高度小。为了测试它是否正常工作,请从该方法中返回一些显著大的值。 - Shamsiddin Saidov