【发布时间】:2015-06-01 02:57:19
【问题描述】:
我的表格视图中的单元格不会自动调整其高度以包含内容。我正在为单元原型使用“基本”样式。我创建了一个只包含我的视图控制器和故事板的新测试项目,它也有同样的问题。我做错了什么?
RowHeightTestController:
@implementation RowHeightTestController
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// Return the number of rows in the section.
return 2;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Test" forIndexPath:indexPath];
// Configure the cell...
cell.textLabel.text = @"Testing";
cell.textLabel.font = [UIFont systemFontOfSize:60 + indexPath.row];
return cell;
}
@end
故事板:
我所看到的:
【问题讨论】:
标签: ios objective-c uitableview uikit