我通过子类化 UITableViewCell 创建了一个新的自定义 TableViewCell。我使用 Nib 创建了一个带有 UIImage View 的 TableView ,并将它与 View 的 socket Hook 。然后,在从我的 TableView 委托(delegate)填充表格时,我使用子类返回表格 View 单元格。
正在加载来自 nib 的新内容。但是自定义表格 View 单元格的新大小(我将表格 View 单元格调整为新的大尺寸)没有加载到表格 View 中。
我是不是在渲染过程中漏掉了一些调用?请帮忙
@interface AccountOption : UITableViewCell
{
IBOutlet UIImageView* optionIcon;
}
@property (nonatomic, retain) IBOutlet UIImageView* optionIcon;
@end
在委托(delegate)中,
NSArray* topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"AccountOption" owner:nil options:nil];
for (id currentCell in topLevelObjects) {
if ([currentCell isKindOfClass:[AccountOption class]]) {
cell = currentCell;
}
}
cell.optionIcon.image = [(NSDictionary*)[accountOptions objectAtIndex:indexPath.row] objectForKey:@"icon"];
return cell;
最佳答案
您需要在界面生成器、 View Controller 中的代码或 TableView 委托(delegate)方法 tableView:heightForRowAtIndexPath:
关于ios - 自定义表格 View 单元格未根据 Nib 调整大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7951342/