gpt4 book ai didi

ios - 具有自动布局的典型 UITableViewCell

转载 作者:可可西里 更新时间:2023-11-01 06:15:32 24 4
gpt4 key购买 nike

如何使用 Interface Builder 和自动布局布局以下 UITableViewCellLayout

要求

  • imageView 垂直居中并具有固定大小。
  • textLabeldetailTextLabel 之间有固定的垂直间距。
  • textLabeldetailTextLabel 必须相对于 imageView 垂直居中。
  • textLabeldetailTextLabel 的总高度不得大于 imageView 的高度。
  • 如果需要,textLabeldetailTextLabel 可以使用多行。 textLabel 的优先级高于 detailTextLabel

示例

(不是像素完美的)

detailTextLabel two lines textLabel two lines

最佳答案

并非所有这些要求都可以使用自动布局来表达。如果你想要那么复杂的东西,你将不得不执行手动布局实现 -layoutSubviews。

在这种情况下,考虑到它只有 3 个 View ,因此不会有很多代码。

关于ios - 具有自动布局的典型 UITableViewCell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19665713/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com