【发布时间】:2017-06-15 11:56:10
【问题描述】:
我尝试制作一个充满图片的表格视图。这是我想要的和我的限制:
- 图片的宽高比为 3:2
cell.width 中的图像 = cell.height 中的图像,乘数为 3:2
- 图片的宽度要占整个屏幕宽度
cell.centerX 中的图像 = Superview.centerX
cell.width 中的图像 = Superview.width
Table View.Center X = Superview.Center X
表格 View.width = Superview.width
- 图片间距应为 8
Cell.Bottom = Cell.Bottom + 8 中的图像
- 其他限制:
table view.top = top layout guide.bottom
table view.bottom = red block.top
这就是我得到的:
我有三张图片,一张在屏幕上可见,另外两张在滚动时可见。 我在屏幕底部也有一个红色块。表格视图在红色块的后面。
我的问题是每张图片都有一个空白区域。我猜它来自与我的图片高度不匹配的内容视图或单元格高度,但我没有设法使它正确。
通过一些更改,我在图片之间获得了正确的空间,但“屏幕上”的纵横比不再受到尊重(= 图片宽度似乎超过了屏幕宽度)。如果我在 Cell.height 中添加 cell.height = Image 会发生这种情况。而且我还得到了 aspect = 3:2、height = Image in Cell.height、Image in Cell.width = width 和 height = 400 的冲突约束。
你看出什么问题了吗?
谢谢,
亚历克斯
【问题讨论】:
标签: ios uitableview uistoryboard