Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/97.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 在tableView中折叠和展开视图_Ios_Swift_Uitableview_Animation_Constraints - Fatal编程技术网

Ios 在tableView中折叠和展开视图

Ios 在tableView中折叠和展开视图,ios,swift,uitableview,animation,constraints,Ios,Swift,Uitableview,Animation,Constraints,我想在tableView中展开和折叠视图。观看了以下视频: ishidden=true不起作用,因为高度仍然存在 func expandCollapse(sender:UIButton) { let collapseImage = UIImage(named: "collapse") let expandImage = UIImage(named: "expand") let row = sender.tag let indexPath = NSInde

我想在tableView中展开和折叠视图。观看了以下视频:

ishidden=true不起作用,因为高度仍然存在

  func expandCollapse(sender:UIButton) {

    let collapseImage = UIImage(named: "collapse")
    let expandImage = UIImage(named: "expand")

    let row = sender.tag
    let indexPath = NSIndexPath(forRow: row, inSection: 0)

    let cell = self.table.cellForRowAtIndexPath(indexPath) as! ArchiveViewCell


    if (sender.currentImage == UIImage(named: "expand")) {
        sender.setImage(collapseImage, forState: UIControlState.Normal)

        cell.moreViewHeight.priority = 1
        cell.moreViewHeight.constant = 0

        cell.moreView.layoutIfNeeded()

    } else {
        sender.setImage(expandImage, forState: UIControlState.Normal)

        cell.moreViewHeight.priority = 999
        cell.moreView.layoutIfNeeded()

    }

在else块中,您是否尝试将
单元格.moreViewHeight.constant
更改回视图的原始高度,而不仅仅是更改优先级?但原始高度并不总是相同的,这取决于else块中的内容,您是否尝试过将
单元格.moreViewHeight.constant
更改回视图的原始高度,而不仅仅是更改优先级?但是原始高度并不总是相同的,这取决于内容