UITableView layout messing up on push segue and return. (iOS 8, Xcode beta 5, Swift)

后端 未结 7 902
清歌不尽
清歌不尽 2020-12-07 13:44

tldr; Auto constrains appear to break on push segue and return to view for custom cells

Edit: I have provided a github example proj

7条回答
  •  心在旅途
    2020-12-07 14:15

    If you have set tableView's estimatedRowHeight property.

    tableView.estimatedRowHeight = 100;
    

    Then comment it.

    //  tableView.estimatedRowHeight = 100;
    

    It solved the bug which occurs in iOS8.1 for me.

    If you really want to keep it,then you could force tableView to reloadData before pushing.

    [self.tableView reloadData];
    [self.navigationController pushViewController:vc animated:YES];
    

    or do it in viewWillDisappear:.

    - (void)viewWillDisappear:(BOOL)animated {
        [super viewWillDisappear:animated];
        [self.tableView reloadData];
    }
    

    Hope it helps.

提交回复
热议问题