Augustyniak / RATreeView

Library providing easy-to-use interface for displaying tree structures on iOS and tvOS.
MIT License
2.49k stars 464 forks source link

iOS9 Cell Indentation #161

Open terranisaur opened 8 years ago

terranisaur commented 8 years ago

iOS9 has added a 'feature' that indents cells based on the total width of the cell, instead of a fixed amount, so some of the cells in my RATreeViews were messed up in iOS9. It was not obvious what was going on right away or how to fix it, since the RATreeView's tableView property is private. I thought I would report this to you with my solution, but that you may have a different way to solve this (or there may be a preexisting one I missed).

In an RATreeView subclass, for iOS9, set the tableView's cellLayoutMarginsFollowReadableWidth to NO to stop the cells from indenting based on the total width of the cell. if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_8_1) { ((UITableView *)[self valueForKey:@"tableView"]).cellLayoutMarginsFollowReadableWidth = NO; }

Troy-Walters commented 8 years ago

If somebody else comes across this looking for the issue I had (appeared @terranisaur solution would work, but didn't). Check you storyboard constraints - I was going off First Item "Relative to margin" which was causing the issue. As soon as I removed this condition the cells stopped indenting.