我已确保单元格的自动调整大小蒙版允许灵活的宽度,但当设备旋转时,单元格的大小不会调整。
我还验证了表格视图已调整大小,问题直接出在单元格上。
这是我用来创建单元格的代码:
if (cell == nil) {
// Load the top-level objects from the custom cell XIB.
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"MetaTableViewCell" owner:self options:nil];
// Grab a pointer to the first object (presumably the custom cell, as that's all the XIB should contain).
cell = [topLevelObjects objectAtIndex:0];
}
有人能想到可能出了什么问题吗?
使用 IB 创建的单元是否从未调整过大小?
如果单元格的高度未调整大小,我建议您修改UITableView
旋转后的委托方法。
-
(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if(condition)// has rotation taken place
// new height
else
// old height
}
请确保您致电[tableView reloadData];
当发生旋转时。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)