I have a UITableViewCell with a UIImage fixed in the upper left and the label on the right:
-(UITableViewCell*) adCellFromTableView:(UITableView*)tableView {
When I run the application on the iOS 7.1 simulator, systemLayoutSizeFittingSize always returns 0:
cell.bounds: {{0, 0}, {320, 0}}
fitSize: {0,0}
When I run the application on iOS 8.1 simulator, systemLayoutSizeFittingSize returns the correct value:
cell.bounds: {{0, 0}, {320, 0}}
fitSize: {320, 154.5}
What am I missing?
Edit: I somehow fixed the problem using [cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize];
instead of [cell systemLayoutSizeFittingSize:UILayoutFittingCompressedSize];
But this is only half the fix: when I rotate while the cell is visible, the size calculation is fine. But when I scroll the cell on the screen, rotate the user interface, and then scroll back to the cell, the height calculation is again incorrect in iOS 7.1
Here are the magazines before turning from landscape to portrait:
Table boundaries: {{0, 0}, {569, 227}}
cell.bounds: {{0, 0}, {569.0}}
cell.contentView: {{0, 0}, {569, 0}}
fitSize: {559, 162}
The following are the magazines after turning from landscape to portrait:
tableView bounds: {{0, 249}, {321, 463}}
cell.bounds: {{0, 0}, {321,0}}
cell.contentView: {{0, 0}, {321, 0}}
fitSize: {559, 162}
As you can see, the size calculation is the same no matter what the width of the cell /cell.contentView is.
This leads to an increase in the size of the cell when rotating from portrait to landscape and to a smaller cell when rotating from landscape to portrait.