iosuitableviewtttattributedlabel

UITableViewCell indentation funkiness


No existing questions quite get at what is happening in my app.

Indentation levels in my UITableViewCell subclass are sporadically either at 1 or 0. The text in the cell will either indent or hug the left margin (seemingly at random) as cells are en- and de-queued. I set the level in cellForRow:, I set the level in my subclass's configure: method, I implement indentationLevelForRow:. None of these has a noticeable effect.

The one thing I can reproduce is that the indentation collapses (level <- 0) when I touch a cell. Another touch doesn't toggle it. I write 'touch' here because this happens even if willSelect: returns nil; Scrolling after these touches sporadically resets levels to 1.

The one thing that might be the problem is that the content view contains a single instance of a 3rd party UILabel subclass TTTAttributedLabel. I don't know much about this code, but there is method, setText:afterInheritingLabelAttributesAndConfiguringWithBlock: which block completion/callback is implemented and could be affecting things. But that doesn't seem to be the case, because nilling the callback makes no noticeable improvement.


Solution

  • I wound up reimplementing the whole view in a Storyboard, and after quite a bit of trial and error with AutoLayout, managed to get the whole thing to work without any bugginess.