OGeek|极客世界-中国程序员成长平台

标题: ios - 为什么推送另一个 View Controller 的动画不流畅? [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 02:25
标题: ios - 为什么推送另一个 View Controller 的动画不流畅?

我在每个单元格上都有一个 TableView 和 Collection View 。
当我点击单元格时,将在单元格的 didSelectRowAt:IndexPath 方法中调用以下代码。

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {

        navigationController?.pushViewController(anotherViewController(), animated: true)

    }

anotherViewController 目前是 Storyboard 上的一个空 View Controller 。它只在 viewDidLoad() 中打印“我来了”。
这是问题所在: 当我触摸单元格时,推送动画似乎卡住了,请查看以下 GIF。
我真的对发生的事情感到困惑。
随时提供任何建议。

下图显示了 View 层次结构。
表格 View 上的单元格。
单元格内容 View 上的 Collection View 和其他组件。
最后, Collection View 的内容 View 上的 ImageView 。

View Hierarchy



Best Answer-推荐答案


我的解决方案是明确设置新 View Controller 的背景颜色,即使它是黑色的。 我遇到了同样的问题,因为我没有使用 Storyboard,所以这就是我的解决方案。

关于ios - 为什么推送另一个 View Controller 的动画不流畅?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45450568/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4