1

I write iOS app with UITableView using custom UITableViewCell's. I have images in different aspect ratio. I setup aspect fill in code.

self.imageView.contentMode = UIViewContentModeScaleAspectFill;
[self.imageView setClipsToBounds:YES];

and got this

enter image description here

Can someone help me to get rid of such alignment?

4

1 回答 1

0

UITableViewCell 会自动调整其图像视图的大小以适应图像的纵横比。只有当视图的纵横比与图像的不同时,内容模式才会发挥作用。

在您的自定义 UITableViewCell 类中覆盖 layoutSubviews 或自己创建一个图像视图(不要使用表格视图单元格提供的那个)。

于 2013-10-17T22:00:11.580 回答