调整 UITableView 中 imageView 的大小
我创建了一个分组表视图,我注意到将图像放置在 imageView 中会导致图像太大。它与单元格的圆形边框重叠,这很可怕。我尝试寻找一种调整其大小的方法,但发现许多答案不太令我满意。你会怎么做?最简单的方法是什么?我发现的解决方案异常复杂。 谢谢!
I Created a grouped table view, and I noticed that placing an image in the imageView results in an image that is too large. It overlaps the rounded borders of the cell, which is horrible. I tried looking for a way to resize it, but I found many answers that didn't quite satisfy me. How would you do this? Which is the simplest way to go? The solutions I found where strangely complicated.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
其他解决方案并不令我满意。我发现的唯一好的解决方案是这个。您可以调整传递给 UIImageView 的 UIImage 的大小。
The other solutions didn't satisfy me. The only good solution I found is this. You can resize the UIImage which is passed to the UIImageView.
最简单的方法是在 Interface Builder 中进行。选择您的
UIImegeView
并转到Inspector 1视图,您可以在此处看到View/Mode,选择ScaleAspectFit
或ScaleToFill
。否则通过代码来完成:
或者
The easy way is doing in Interface Builder. Select your
UIImegeView
and go to the Inspector 1 view, yo can see View/Mode here chooseScaleAspectFit
orScaleToFill
.Else do it by code:
or
抱歉,我犯了一个错误。首先将图像添加到表格视图单元格:
然后设置内容模式:
或
Sorry I made a mistake. First add you image to the tableview cell:
then set the content mode:
or