无法通过按下 UIView xib 上的按钮显示表格视图

Unable to show tableview from button press on UIView xib

在我的应用程序中,用户配置文件包含在用户点击主视图控制器上的按钮时显示的 xib 文件中。在 xib 弹出窗口的底部是一个按钮,显示用户所在区域其他用户分数的排行榜表格视图。我面临的问题是,在 iPhone 8 上,tableview 能够向上滑动并显示,但是在 iPhone X & iPhone 11 上没有任何反应。下面我将包含视图层次结构和约束的屏幕截图

IBAction里面的代码是这样执行的

   @IBAction func userTappedScoresIcon(_ sender: Any) {

    //load tableview data
    score_tblView.reloadData()

    scoreViewTopConstraint.constant = 0.0

    UIView.animate(withDuration: 0.25) {
       self.scoresView.frame = self.profile_scroller.bounds

    }

}

我试过更改情节提要中的约束以及删除表视图顶部的约束,但都没有成功。任何帮助将不胜感激!

你可以试试这个例子

self.topConstraint.constant = -100.0;    
[self.viewToAnimate setNeedsUpdateConstraints]; 
[UIView animateWithDuration:1.5 animations:^{
    [self.viewToAnimate layoutIfNeeded]; 
}];

func AnimateBackgroundHeight() {
   UIView.animateWithDuration(0.5, animations: {
       self.heightCon.constant = 600 // heightCon is the IBOutlet to the constraint
       self.view.layoutIfNeeded()    
   })
}