美文网首页
关于 UITableViewCell 的 indentation

关于 UITableViewCell 的 indentation

作者: 这个汤圆没有馅 | 来源:发表于2019-05-22 17:43 被阅读0次
UITableViewCelltextLabel是有一个默认左边距为10px的。实际上,这是由indentationLevelindentationWidth 控制的缘故。indentationLevel 默认为0,indentationWidth 默认为10。
现在重新对这两个属性赋值。
cell.indentationLevel = 2;
cell.indentationWidth = 50;
运行之后,如下图。cell 的缩进量明显变大了。
缩进量 = indentationLevel * indentationWidth。值得注意的是,当indentationLevel = 0时,无论indentationWidth设为多少,最后缩进量都为10。
但是对于自定义cell来说,indentationLevel 并不能起到缩进效果。如下图。要解决这个问题的话,可能只能通过改变约束来达到目的。

相关文章

网友评论

      本文标题:关于 UITableViewCell 的 indentation

      本文链接:https://www.haomeiwen.com/subject/efpuzqtx.html