菜鸟教程小白 发表于 2022-12-13 02:25:00

ios - 为什么推送另一个 View Controller 的动画不流畅?


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

<pre><code>func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {

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

    }
</code></pre>

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

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

<p> <a href="/image/E1nVl.png" rel="noreferrer noopener nofollow"><img src="/image/E1nVl.png" alt="View Hierarchy"/></a>
<a href="/image/CXu2e.gif" rel="noreferrer noopener nofollow"><img src="/image/CXu2e.gif" alt=""/></a> </p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>我的解决方案是明确设置新 ViewController 的背景颜色,即使它是黑色的。
我遇到了同样的问题,因为我没有使用 Storyboard,所以这就是我的解决方案。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 为什么推送另一个 ViewController 的动画不流畅?,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/45450568/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/45450568/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 为什么推送另一个 View Controller 的动画不流畅?