This seems like a very basic operation which has been made overly complex.
I have a uitableview with cells which i am trying to resize using heightForRowAtIndexPath. I need the cells to resize based on the text they contain and so I am using attributed string boundingRectWithSize, passing in the width of the table and the height of the window and using the correct font from the dequeued cell and UsesLineFragmentOrigin.
For many cases this cuts off the last line of text and I believe it is due to an offset between the cell's content view and the tableview edges, such that when I give boundingRectWithSize the width of the table it miscaculates the height.
I can even see this offest when I turn on view debugging "show view frames." There are equal offsets on the left and right sides of the content view.
However, I cant figure out how to access this offset in the method heightForRowAtIndexPath. From view debugging, I know that the difference between the width of the table and the contentview is 40 but I dont want to hardcode that value. My best guess at where this is located is a property of UITableView called "separatorInset" which is an edgeInset which has "left" "right" "up" and "down" dimensions. However, when I inspect that property, all dimensions are zero except for "left" which is 20.
Since I know the difference is 40, if I pass the width minus "left"*2 into boundingRectWithSize, the size is correct for all my test strings.
However, this bothers me since what I would expect to pass is width - "left" - "right" and just using left*2 more or less amounts to hard coding 40.
Am I missing the real property which would tell me what the left and right offsets are or is "separatorInsets" bugged or do "left" "right" "up" "down" signify something other than the obvious? Thanks.