UITableView contentMode not working

454 views Asked by At

I have a UITableView and I set its contentMode to bottom. I expected when the orientation changes, the bottom part of the UITableView will stay foot and the top part will change.

Yet this doesn't happen.

I printed the content mode on the willRotate method and it seems fine.

Any ideas what could bother it?

2

There are 2 answers

0
Anton Tyutin On

Actually, contentMode for UITableView does not work that way.

If you need the first cell on a bottom, you need to apply M_PI rotation affine transform to your tableView and then rotate each cell back on M_PI.

0
Jordan Smith On

I don't think contentMode is what you're after. That property usually only has an effect on more granular views, like a UIImageView.

It sounds like you're wanting to control how the view is scaled and stretched, I think what you're looking for is iOS's 'auto layout' feature. You can get started here: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/