【发布时间】:2016-12-06 14:20:00
【问题描述】:
我有一个带有文本视图的自定义 UITableViewCell。
textView 的高度根据其文本增加。
我不知道如何增加单元格高度以适应文本视图。
这是我的代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NotificationCell *cell = (NotificationCell *)[tableView dequeueReusableCellWithIdentifier:@"cell"];
if (cell == nil) {
NSArray *ary = [[NSBundle mainBundle]loadNibNamed:@"NotificationCell" owner:self options:nil];
cell = [ary objectAtIndex:0];
}
NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithDictionary:[NotificationArray objectAtIndex:indexPath.section]];
cell.title_lbl.text=[dict objectForKey:@"event_title"];
cell.description_lbl.text=[dict objectForKey:@"description"];
[cell.description_lbl sizeToFit];
[cell sizeToFit];
return cell;
}
【问题讨论】:
标签: ios objective-c xcode autolayout xib