在我的应用程序中,用户配置文件包含在xib文件中,该文件在用户点击主视图控制器上的按钮时显示。 xib弹出窗口的底部是一个按钮,该按钮显示用户在其区域内其他用户的分数的排行榜表格视图。我面临的问题是,在iPhone 8上,表格视图可以向上滑动并显示,但是在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()
})
}