iOS App Freezes on PushViewController
We have faced the same problem couple of weeks back. And for our problem we narrowed it down to left-edge pop gesture recogniser
. You can try and check if you can reproduce this problem using below steps
- Try using the left edge pop gesture when there are no view controllers below it (i.e on root view controllers, your
VC-Home
controller) - Try clicking on any UI elements after this.
If you are able to reproduce the freeze, try disabling the interactivePopGestureRecognizer
when the view controller stack have only one view controller.
Refer to this question for more details. Below is the code from the link for ease of reference.
- (void)navigationController:(UINavigationController *)navigationController
didShowViewController:(UIViewController *)viewController
animated:(BOOL)animate
{
if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)])
{
if (self.viewControllers.count > 1)
{
self.interactivePopGestureRecognizer.enabled = YES;
}
else
{
self.interactivePopGestureRecognizer.enabled = NO;
}
}
}
iOS - App freezes when push from navigation controller
I managed to find a solution here
So my interactivePopGestureRecognizer
is enabled even when the current visible view controller is the only VC on the navigation stack. Simply disable that will solve the bug.
UINavigationController pushViewController pauses/freezes midway through
With out more detail I can think of 2 possible problem with that.
Is there Shadow added in code to the view that will be covered by the new ViewController. If it is the case, use ShadowPath or an translucent view instead (the property Shadow is expensive while animating, been there done that)
Is the backgroundColor of new ViewController "clearColor" ? I've seen strange rendering problem with that kind of thing.
Try:
UIViewController *vc = [[UIViewController alloc] init];
vc.view.backgroundColor = [UIColor whiteColor];
[self.navigationController pushViewController:vc animated:YES];
That is the 2 possible problems I can think of the top of my head with so few detail.
Never rely on the default background color, it has change with iOS version and is not consistant across controls and can even be different if the view is created in code or from a Xib (in the same iOS version).
Related Topics
Finish All Asynchronous Requests Before Loading Data
Shift Elements in Array by Index
What's the Best Way to Handle Multiple Skscenes
Swift Editor Placeholder in Source File
How to Trap on Uiviewalertforunsatisfiableconstraints
Stop Uiwebview from "Bouncing" Vertically
Core Data Background Context Best Practice
Changing Navigation Bar Color in Swift
How to Dismiss Viewcontroller in Swift
Ios: What's the Fastest, Most Performant Way to Make a Screenshot Programmatically
In iPhone App How to Detect the Screen Resolution of the Device
Iphone: How to Get Current Milliseconds
How to Dismiss the Keyboard When Editing a Uitextfield
How to Calculate Uilabel Width Based on Text Length
iOS Keeping Old Launch Screen and App Icon After Update