具有自动布局的典型UITableViewCell

时间:2013-10-29 17:55:57

标签: ios uitableview interface-builder autolayout

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

要求

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

实施例

(不像素完美)

detailTextLabel two lines textLabel two lines

1 个答案:

答案 0 :(得分:0)

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

在这种情况下,考虑到它只有3个视图,它不会是很多代码。