开发者

iOS - how to handle orientation changes in custom table cells

I have subclassed UITableViewCell to make a custom cell for a tableView. I add text and 开发者_如何学Cimages to the cell's contentView.

Everything looks great in landscape mode (iPad), but no so much when I rotate to portrait. Where is the best place to handle orientation changes so that all the table cells can reposition the contents in its contentView? Do I put this code in the TableViewController or in the UITableViewCell subclass?


You can play with autoresizingMask of your cell's views to see that maybe the proper result can be achieved automatically. If that doesn't work out, in your tableView's willAnimateRotationToInterfaceOrientation you can do:

NSArray* visibleCells = [tableView indexPathsForVisibleRows];
[self.tableView reloadRowsAtIndexPaths:visibleCells withRowAnimation:NO];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜