iOS SDK UIViewContentModeScaleAspectFit与UIViewContentModeScaleAspectFill
我有一个图像,我想在
UITableViewCell
中使用提供UIImageView
的UITableViewCellStyleSubtitle
样式,两行文本以及可选的附件视图显示。
但是,当我将UIImageView
的内容模式设置为UIViewContentModeScaleAspectFit
或UIViewContentModeScaleAspectFill
时,它似乎没有区别。这两种内容模式都只显示整个图像,将文本向右移动以为图像腾出空间。
有没有人在实践中有任何实际差异的例子?文档说:
UIViewContentModeScaleAspectFit:
Scales the content to fit the size of the view by maintaining the aspect ratio. Any remaining area of the view’s bounds is transparent.
UIViewContentModeScaleAspectFill:
Scales the content to fill the size of the view. Some portion of the content may be clipped to fill the view’s bounds.
但是这些内容模式似乎没有像宣传的那样表现。
编辑:我正在运行SDK iOS 4。
没有找到相关结果
已邀请:
2 个回复
玖料萄
自动调整其图像视图的大小以适合图像的宽高比。仅当视图的宽高比与图像不同时,内容模式才会发挥作用。 在自定义
类中覆盖
或自己创建图像视图(不要使用表格视图单元格提供的图像视图)。
才改隘瘁
如果你想要它有点花哨,看看这篇文章: UIImageView改变宽度和高度