iphone - UITableViewCell imageView.contentMode 在 3.0 中不起作用

标签 iphone uitableview imageview tablecell contentmode

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/

相关文章:

iphone - UISegmentedControl 不检测 iOS5 中的段更改

iphone - 如何将选定的 uitableviewcell 变量传递给以前的 View Controller ?

android - 当它有白色的android时,为什么图像显示为浅灰色背景?

android - ImageView 的比例类型意外行为

iphone - 使应用程序进入AppStore需要哪些步骤?

iphone - 如何显示自定义弹出窗口而不是UIMenuController

iPhone HTML 问题 - 仅访问正文

ios - Swift 4 backgroundColor 错误?

xcode - 无法使用解析本地数据存储保存和查询数据

android - 将 ImageView 从 PNG 替换为 GIF