简体   繁体   English

Push segue 过渡动画断断续续

[英]Push segue transition animation is choppy

Push segue transition animation is somewhat choppy <- The explanation of the issue in that post states my issue exactly: Push segue 过渡动画有点不稳定<-该帖子中对问题的解释准确地说明了我的问题:

"I am using push segue with default animation for transitions on the navigation controller. However, the animation seems to be somewhat choppy. While pushing a new view controller, source view controller shifts left and hangs halfway through. And a moment after this, destination view controller appears." “我在导航控制器上使用带有默认动画的 push segue。但是,动画似乎有些断断续续。在推送新的视图控制器时,源视图控制器向左移动并在中途挂起。在此之后,目的地视图控制器出现。”

The storyboard I have is almost like this...我的故事板几乎是这样的......

在此处输入图片说明

...with the following exception: my master view is a UIViewController consisting of 2 container views, both containing UITableViewControllers, both dynamic tables. ...有以下例外:我的主视图是一个 UIViewController,由 2 个容器视图组成,都包含 UITableViewControllers,两个都是动态表。 Selection from one of the tables pushes the detail view onto the stack (same as the storyboard example above).从其中一个表中选择将细节视图推入堆栈(与上面的故事板示例相同)。 That push is the "choppy" animation那个推动是“断断续续”的动画

Like the OP's issue, the master view is shifting left behind the semi-transparent detail view that is shifting into view from the right side of the screen.与 OP 的问题一样,主视图向左移动,半透明详细视图从屏幕右侧移入视图。 When the detail view is fully in view, approx half of the master is still in view behind the detail view momentarily, and then it disappears.当细节视图完全在视图中时,大约一半的母版仍然在细节视图后面的视图中,然后消失。

All other transitions (push, pop, modals, dismisses, etc) are smooth.所有其他过渡(推、弹出、模态、解除等)都是平滑的。 This applies only to devices that cannot display both of the split views at the same time, so no iPads.这仅适用于无法同时显示两个拆分视图的设备,因此不适用于 iPad。

I also recently had this problem using a Master Detail storyboard with an embedded Navigation Controller.我最近在使用带有嵌入式导航控制器的主细节故事板时也遇到了这个问题。 The choppy animation of the segue may have started when I changed the global tint but did not resolve when I changed to back.当我更改全局色调时,segue 的断断续续动画可能已经开始,但当我更改为 back 时没有解决。 The issue was fixed when I changed the Background of the View of the Detail screen from Default to a different color.当我将详细信息屏幕视图的背景从默认更改为不同颜色时,问题得到解决。 I found it did not make any difference which color as long as it was not Default.我发现只要它不是默认颜色,它就没有任何区别。

Be sure your UI updates are in the main thread and if the code is already on the main queue then if you using dispatch_async may only going to have overhead.确保你的 UI 更新在主线程中,如果代码已经在主队列中,那么如果你使用dispatch_async可能只会有开销。 Especially in your prepareForSegue method or in the viewWillAppear there shouldn't be heavy pieces of code (that should stay in the background thread) in main thread that causing this kind of things.特别是在你的prepareForSegue方法或viewWillAppear中,主线程中不应该有大量代码(应该留在后台线程中)导致这种事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM