您可以定义一个UIView的内您的控件,您可以对于该视图的高度限制采取iboutlet。你需要将它设置为0,并单击单元格内的Button时,需要将其设置为适当的高度,然后在indexpath处重新加载该行。
例如。
Iboutlet UIVIEW *viewCustomControls; // This contains your extra controls which you want to show on the button clicked.
Iboutlet NSLayoutConstraints *cons_height_viewControl; // This is the constraint outlet for the viewCustomControls Height.
当你点击了您的点击事件里面的按钮...
{
if (need to expands)
{
cons_height_viewControl.constants = 100 // To expand, Here is approximate value you can make as you want.
}else{
cons_height_viewControl.constants = 0 // To collapse
}
self.tableView.beginUpdates()
self.tableView.reloadRowsAtIndexPaths:(arrIndexPaths withRowAnimation:UITableViewRowAnimation.Fade)
self.tableView.endUpdates()
}
怎么样只是重装电池? – ogres
谢谢@ogres,按钮操作在我的tableViewCell中处理,我怎样才能调用tableview的reloadRowsAtIndexPath? –
将代表从外部(您正在创建单元格的位置)设置为单元格,并且当点击该按钮时,调用代表该按钮的代理,然后重新加载它 – ogres