显示不同高度的图像
所以,我试图用图像做一个列表,具有不同的高度,如下所示:
_______ _______
| IMG1 | | IMG4 |
|_______| | |
_______ | |
| IMG2 | | |
| | |_______|
|_______| _______
_______ | IMG5 |
| IMG3 | | |
| | |_______|
| | _______
| | | IMG6 |
|_______| |_______|
人们可以滚动。我考虑过使用TableView
,但是UITableViewCell
必须有固定的高度。有什么想法吗?
So, I'm trying to do a list with images, with different height, like this:
_______ _______
| IMG1 | | IMG4 |
|_______| | |
_______ | |
| IMG2 | | |
| | |_______|
|_______| _______
_______ | IMG5 |
| IMG3 | | |
| | |_______|
| | _______
| | | IMG6 |
|_______| |_______|
And the people can scroll. I thought about using TableView
, but the UITableViewCell
must have a fixed height. Any idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您有固定大小的 6 个图像,那么我建议使用六个您想要放置在滚动视图中的任何大小的 uiimageview,然后以编程方式设置图像。
If you have fixed 6 image of fix size,then i suggest to use six uiimageview of whatever size you want place in scroll view, and then set image programmatically.
UITableView
通过其委托的tableView:heightForRowAtIndexPath:
方法支持不同高度的单元格。但如果您想要两列图像,其中所有图像的高度不同,则需要使用 UIScrollView。UITableView
supports cells of varying heights, via thetableView:heightForRowAtIndexPath:
method of its delegate. But if you want two columns of images, where all the images are different heights, you'll need to useUIScrollView
.