OGeek|极客世界-中国程序员成长平台

标题: ios - UITableView 单元格在调整大小后不响应输入 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 16:25
标题: ios - UITableView 单元格在调整大小后不响应输入

我在表格 View 中添加新行并根据其内容调整其大小,但调整大小后,单元格内容,如按钮和 didSelectRowAtIndexPath: 没有被调用。

这是调整大小的代码:

CGRect frame = cell.replayTableView.frame; 
int height = (model.replyComments.count*61)+3; 
frame.size = CGSizeMake(cell.replayTableView.frame.size.width, height); 
cell.tableviewReplay.refTable.frame=frame;



Best Answer-推荐答案


在 heightForRowAtIndexPath 上分配一个高度

-(CGFloat)tableViewUITableView *)tableView heightForRowAtIndexPathNSIndexPath *)indexPath
{
  if (indexPath.Row == 1)
     return 50.0;
  else if (indexPath.Row == 2)
     return 60;   
}

关于ios - UITableView 单元格在调整大小后不响应输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32837238/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4