在UITableViewCellStyleDefault
中,在imageView上设置contentMode
没有结果。如果我将构建 SDK 更改为版本 3.1,一切都会恢复正常。
在 3.0 上编译时,我没有收到任何警告或错误,但这段代码:
cell.imageView.contentMode = UIViewContentModeScaleAspectFit;
cell.imageView.image = [UIImage imageNamed:[[NSString stringWithFormat:@"%@head.jpg",[gametype objectAtIndex:indexPath.row]]lowercaseString]];
似乎默认为 UIViewContentModeCenter,因此我的所有图片都超出了单元格边界并侵占了相邻单元格。
让我重申一下,如果我将目标更改为 3.1,一切都会正常工作,并且所有图片都会相应缩放以适合默认的 imageView
这是一个已知的错误吗?
最佳答案
使用 UITableViewCellStyleDefault 时,我在 iOS 4 SDK 上得到了相同的效果。
有关其他信息,请参阅 iOS SDK UIViewContentModeScaleAspectFit vs. UIViewContentModeScaleAspectFill
关于iphone - UITableViewCell imageView.contentMode 在 3.0 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2383856/