UITableViewCell 的 textLabel是有一個(gè)默認(rèn)左邊距為10px的。實(shí)際上,這是由indentationLevel 和 indentationWidth 控制的緣故。indentationLevel 默認(rèn)為0,indentationWidth 默認(rèn)為10。
現(xiàn)在重新對(duì)這兩個(gè)屬性賦值。
cell.indentationLevel = 2;
cell.indentationWidth = 50;
運(yùn)行之后,如下圖。cell 的縮進(jìn)量明顯變大了。
縮進(jìn)量 = indentationLevel * indentationWidth。值得注意的是,當(dāng)indentationLevel = 0時(shí),無(wú)論indentationWidth設(shè)為多少,最后縮進(jìn)量都為10。

但是對(duì)于自定義cell來(lái)說(shuō),indentationLevel 并不能起到縮進(jìn)效果。如下圖。要解決這個(gè)問(wèn)題的話,可能只能通過(guò)改變約束來(lái)達(dá)到目的。
