Ank*_*kit 4 objective-c uitableview uitableviewautomaticdimension ios9
我正在使用iOS9 XCode7我需要根据labelText高度动态更改单元格的高度
我用过:
self.tableView.rowHeight=UITableViewAutomaticDimension;
Run Code Online (Sandbox Code Playgroud)
但它不适用于定制电池.
sizetoFit
在iOS9中删除.
请提出建议.谢谢
Har*_*hak 13
给你的标签约束相对于单元格,顶部,底部,左侧和右侧.
比您的单元格大小将随内容高度增长.
也使你的标签多行.(通过在属性检查器中将Lines属性设置为0)
#pragma mark- Menu table Delegates
-(CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath{
return UITableViewAutomaticDimension;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return UITableViewAutomaticDimension;
}
Run Code Online (Sandbox Code Playgroud)