使用 XIB 在 UITextView 上设置内容插入

Setting content insets on UITextView using XIB

我有一个 UITableViewCell,其中包含一个 UITextView

我想在此文本视图上设置内边距,以便单元格内容在每一侧被推入 10。

我知道我可以使用 textView.textContainerInset = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)

在代码中执行此操作

在处理 XIB 文件时是否可以使用 IB?

您可以使用 Rect 类型设置 Key Path

这应该能达到您的要求。