显示不同高度的图像

发布于 2025-01-07 16:12:04 字数 423 浏览 3 评论 0原文

所以,我试图用图像做一个列表,具有不同的高度,如下所示:

 _______   _______
| 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

也只是曾经 2025-01-14 16:12:04

如果您有固定大小的 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.

诺曦 2025-01-14 16:12:04

UITableView 通过其委托的 tableView:heightForRowAtIndexPath: 方法支持不同高度的单元格。但如果您想要两列图像,其中所有图像的高度不同,则需要使用 UIScrollView。

UITableView supports cells of varying heights, via the tableView:heightForRowAtIndexPath: method of its delegate. But if you want two columns of images, where all the images are different heights, you'll need to use UIScrollView.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文