swift3 - UILabel 和 UITextView 未正确对齐

标签 swift3 uilabel ios-autolayout

我确实有一个 UILabel 和 UITextView 彼此重叠,与自动布局左对齐。但它看起来像这样:

enter image description here

正确对齐这些的最佳方法是什么?

最佳答案

最简单的方法是直接设置内容插入。

textView.contentInset = UIEdgeInsetsMake(-4,-4,0,0)

结果看起来像

enter image description here

关于swift3 - UILabel 和 UITextView 未正确对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45110922/

相关文章:

ios - 如何在底部插入带有动画的 UITableViewCell?

swift - 如何通过自动布局设置 Collection View 的单元格大小

ios - didReceiveRemoteNotification 未通过 FCM 接收通知

ios - 在 iOS Swift 中将 NSDate 转换为字符串

ios - 你如何让 Swift 等待 SKAction 被执行?

ios - 扩展符合 NSFetchRequestResult 的协议(protocol)

ios - UILabel - 如何在 Swift 3 中的行之间添加空格

ios - 从 UIView 获取 UILabel

ios - UILabel 动态高度与 UIImageView 恒定高度

ios - 不同方向的快速布局