Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/101.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 具有“显示更多”按钮动作的动态标签和单元格高度_Ios_Objective C_Swift3_Reactive Cocoa_Rx Swift - Fatal编程技术网

Ios 具有“显示更多”按钮动作的动态标签和单元格高度

Ios 具有“显示更多”按钮动作的动态标签和单元格高度,ios,objective-c,swift3,reactive-cocoa,rx-swift,Ios,Objective C,Swift3,Reactive Cocoa,Rx Swift,单击“显示更多”按钮后,我试图在tableViewCell中实现动态标签高度。标签需要设置label.numberOfLines=0 然后单元格高度和标签高度应动态增加 下面是我的代码(当tableView重新加载重复使用单元格的相同标签高度时) 您还需要管理RowAtIndexPath的高度: func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {

单击“显示更多”按钮后,我试图在
tableViewCell
中实现动态标签高度。标签需要设置
label.numberOfLines=0

然后单元格高度和标签高度应动态增加

下面是我的代码(当
tableView
重新加载重复使用单元格的相同标签高度时)


您还需要管理RowAtIndexPath的高度:

func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return UITableViewAutomaticDimension
    }
在showMore按钮操作中

@IBAction func showmorePressed(_ sender: Any) {
    detailtextLabel.numberOfLines = 0;
         self.tableView.reloadData()
}

按ViewMore键时,返回索引路径行的高度处的
UITableViewAutomaticDimension
,否则返回一些静态值height@Bharath问题已解决?我已经为行设置了高度。但我还是明白了这个问题@Ganesh@Bharath你用的是swift 3吗?然后tableview.reloadData它应该是…。还要检查是否通过放置断点调用showMorePressed acton。我仍然遇到同样的问题。你能帮我解决这个问题吗?
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return UITableViewAutomaticDimension
    }
@IBAction func showmorePressed(_ sender: Any) {
    detailtextLabel.numberOfLines = 0;
         self.tableView.reloadData()
}