ios - UITableView 单元格在调整大小后不响应输入

标签 ios objective-c uitableview cocoa-touch

我在 TableView 中添加新行并根据其内容调整其大小,但调整大小后,单元格内容(例如按钮和 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;

最佳答案

在 heightForRowAtIndexPath 上分配高度

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
  if (indexPath.Row == 1)
     return 50.0;
  else if (indexPath.Row == 2)
     return 60;   
}

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

相关文章:

ios - 基于一对多关系的Coredata NSFetchedResultsController谓词(外部)

objective-c - 如何从巨大的文本文件中读取文本 block ?

ios - TableView 在删除时不选择新行

ios - 从过滤器列表和原始列表中删除项目

ios - 我什么时候应该使用原子 ios?

ios - 如何在 UIButton 的文本边缘添加额外的空间?

ios - 将 JSON Tableview 信息解析为单独的字符串

iphone - 数组与数组 :nil returns empty array but not documented

iphone - 如何在iPhone上显示Xpath

objective-c - 什么决定了 UITableView 的边距有多高和多宽? (见图)