关于 UITableViewCell 的 indentationLevel

UITableViewCelltextLabel是有一个默认左边距为10px的。实际上,这是由indentationLevelindentationWidth 控制的缘故。indentationLevel 默认为0,indentationWidth 默认为10。
现在重新对这两个属性赋值。
cell.indentationLevel = 2;
cell.indentationWidth = 50;
运行之后,如下图。cell 的缩进量明显变大了。
缩进量 = indentationLevel * indentationWidth。值得注意的是,当indentationLevel = 0时,无论indentationWidth设为多少,最后缩进量都为10。
但是对于自定义cell来说,indentationLevel 并不能起到缩进效果。如下图。要解决这个问题的话,可能只能通过改变约束来达到目的。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章