【发布时间】:2011-02-24 07:17:29
【问题描述】:
有没有办法调整表格视图的大小并让文本在 iPhone 中换行?我正在使用以下代码,它成功调整了单元格的高度,但是文本没有换行,它只是以“....”结尾
- (CGFloat)tableView:(UITableView *) tableView heightForRowAtIndexPath: (NSIndexPath *)indexPath {
CGSize cellHeight;
City *thisCity = [cities objectAtIndex:indexPath.row];
NSString * myString = thisCity.cityName;
cellHeight = [myString sizeWithFont:[UIFont systemFontOfSize:13.0f] constrainedToSize:CGSizeMake(300.0, 1000.0) lineBreakMode:UILineBreakModeWordWrap];
return cellHeight.height + 20;
}
【问题讨论】:
标签: iphone tableview word-wrap