UITableViewCell imageView.contentMode 在 3.0 中不起作用

发布于 2024-08-23 11:47:25 字数 544 浏览 5 评论 0原文

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

这是一个已知的错误吗?

In UITableViewCellStyleDefault, setting the contentMode on the imageView has no result. If I change my build SDK to version 3.1, everything again works.

I don't get any warnings or errors when compiling on 3.0 but this code:

cell.imageView.contentMode = UIViewContentModeScaleAspectFit;
cell.imageView.image = [UIImage imageNamed:[[NSString stringWithFormat:@"%@head.jpg",[gametype objectAtIndex:indexPath.row]]lowercaseString]];

seems to default to the UIViewContentModeCenter, so all of my pictures exceed the cell boundaries and encroach on neighboring cells.

Let me reiterate that if I change my target to 3.1 everything works correctly and all pictures are scaled accordingly to fit in the default imageView

Is this a known bug?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一百个冬季 2024-08-30 11:47:25

使用 UITableViewCellStyleDefault 时,我在 iOS 4 SDK 上得到了相同的效果。

有关更多信息,请参阅 iOS SDK UIViewContentModeScaleAspectFit 与 UIViewContentModeScaleAspectFill

I'm getting the same effect on iOS 4 SDK when using UITableViewCellStyleDefault.

For additional info see iOS SDK UIViewContentModeScaleAspectFit vs. UIViewContentModeScaleAspectFill

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文