ios - 不要让 UILabel 与 UITableViewCell 中的另一个标签重叠

标签 ios uitableview autolayout

我有一个自定义 UITableViewCell,左侧有一个 titleLabel,右侧有一个详细信息标签,类似于 Right Detail 单元格类型。

enter image description here

当前 UILabel 都没有设置宽度,这就是我想要的。然而,titleLabel 有时会很长并与右侧的详细信息标签重叠。

只有当 titleLabel 太长并且会重叠时,我如何才能在两个标签之间留出边距?

最佳答案

您可以做的就是通过将关系 GraterThenOrEqual 例如设置为 10 像素来设置它们之间的最小空间。 或者有一种狡猾的方法,即玩弄优先级与约束。您可以将约束优先级设置为 750。

在界面生成器中,您必须设置标签之间的间距,然后手动选择此约束,然后您将看到菜单 enter image description here

名为Relation,只需选择GraterOrEqual

关于ios - 不要让 UILabel 与 UITableViewCell 中的另一个标签重叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39375817/

相关文章:

ios - 新的 Cocos2D 3.x API?

ios - 从 iOS 应用程序打开用户的推特个人资料页面

ios - 如何计算动态类型的 estimatedRowHeight

iOS + swift 2 : Dynamic height in UITableViewCell doesn't work with an empty view

ios - 将 View 的 CenterX 限制为父 View 总宽度的一部分

ios - 用户卸载应用程序后删除所有 UILocalNotifications

ios - 苹果 watch : Status bar height

ios - swift4 中的 UITextfield 验证 - 动态单元格

ios - UICollectionView Cell + UiLabel with AutoLayout

ios - 为什么我的约束没有发挥应有的作用?