我有关于自定义单元格高度的问题。当单击单元格上的一个按钮时,我需要增加单元格的高度。她知道使用两种方法(heightforrow和didselectrow),但我很迷惑,当我点击按钮时,按钮动作的自定义方法被调用,我在controller中使用这两种方法。我附上了我的代码:如何更改按钮点击自定义单元格的高度?
在customcell.m
- (IBAction)btnRestPlusClicked:(id)sender
{
UIButton *btn = (id)sender;
btn.selected =!btn.selected;
if (btn.selected)
{
NSLog(@"selected");
// _viewExtraScheduleAmount.hidden = FALSE;//I need to make this event on button action and same time increase the height of cell.
}
else
{
btn.tag = 0;
// _viewExtraScheduleAmount.hidden = TRUE;
}
现在我需要的是,当按钮点击那个时候只有行的高度也会增加。
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
//if (ceel.btnRestPlusClicked.selected)
//{
// return 100;
// }
// return 60;
I know I am wrong here but how to use this method?
}
请问任何人可以帮我解决这个问题吗? 谢谢
谢谢!这是非常有帮助的。它解决了我的问题。再次感谢ruslan.musagitov –
你非常欢迎:) –