How to change height Constraint of UIView in Uitab

2019-08-05 01:32发布

enter image description here

I have a UIView in the UITableViewCell , which needs to change its height when user taps on "less/more" button

My code is

 - (CGFloat)tableView:(UITableView *)tableView       estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return UITableViewAutomaticDimension;
}

1条回答
来,给爷笑一个
2楼-- · 2019-08-05 01:34

Hook items height constraint as IBOutlet and change it in cellForRow like this

 cell.viewHeightCon.constant = // value

and before return cell add

 cell.layoutIfNeeded()
查看更多
登录 后发表回答