3

So I've got a screen that does a check for certain attributes and under defined circumstances will instantly load another view modally in viewDidLoad, without animation, over the currently-loading view (so as not to show the view below). Prior to iOS 8 when this was done, the original view would pause its loading (would not proceed with viewWillAppear, viewDidLayoutSubviews etc.) until the overlaying controller was dismissed. This behaviour I found was appropriate for my needs, as any animation on elements in the original view, could then be done. However, in iOS 8 I'm getting a completely different chain of events. First off, for some reason viewDidLayoutSubviews is being called twice (what's up with that?) but more importantly the view is not liking another controller being popped up at all anytime before viewDidAppear, complaining about unbalanced calls to begin/end appearance transitions. Not only that, but the underlying viewController continues with it's loading (viewWillAppear,viewDidLayoutSubviews etc.) even though it's not being shown which causes all the methods in those events to fire. I appreciate if Apple have updated the way something like this is meant to be achieved, so if the new meta is a completely different process I'm willing to adopt, however, as it is I can't get this to work appropriately.

I'd appreciate any help on how to get this modal view to interject without causing the underlying view to continue it's loading.

Thanks,
Mike

UPDATE: Going to bring some code in. Below is the viewDidLoad of the main viewController that presents the modal VC if need.

-(void) viewDidLoad{

    if(hasNotSeenTutorial){
        TutVC* vc = [[TutVC alloc] initWithNibName:@"tutNib" bundle:nil]

        vc.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
        [self.navigationController presentViewController:vc animated:NO completion:^{
             NSLog(@"Has Completed Presentation");
         }];
    }
}

This is where the issues are. Calling the presentation here in viewDidLoad, causes the presentation of the presenting VC to continue. Prior to iOS 8 the presenting VC if not yet presented, would pause, until the modal VC had been dismissed, it would then complete as usual. This is not the case in iOS 8, as per my original post.

Ekta Padaliya
  • 5,743
  • 3
  • 39
  • 51
Mackey18
  • 2,322
  • 2
  • 25
  • 39

1 Answers1

1

Apple has made its rules stricter with ios 8. To give you an example and I ll drive my point through this:- In my app i used to pop some view controllers off the navigation stack and just after that, push the a new one, but that pop was never seen in ios7, only a push transition appeared to happen (when logically, pop should have been seen and then the push). And in ios 8 this thing changed. Now a push is seen only after the pop is seen and noticed. which breaks the UX rather badly.

I have noticed this strictness in other areas as well but those are not UI/UX related so i wont go into its detail right now.

As far as your situation go, With my experience I can tell you that you ve been doing stuff in a wrong manner. As apple has gone strict your implementation seems to break. The only solution in my opinion is to shift every check in viewdidAppear.

If you wish to continue the way you were doing for ios7 earlier you might use this check:

    if([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
{
  // Code for ios 8 implementation
}
else
{
  // Code for ios 7 implementation
}

Though i would reccomend you to avoid because wat u are aiming is perfectly achievable. Also what you are doing can easily cause inconsistency in the navigation stack which can crash the application.

Abhishek Arora
  • 395
  • 2
  • 12
  • Not sure why this has been voted down. If Apple has changed its internal rules, we need to know about it. I'm dealing with an issue now (http://stackoverflow.com/questions/25987244/autolayout-problems-with-ios8-with-code-that-works-fine-on-ios7) and I'm wondering if I might be caught in a similar web. – Gallymon Sep 26 '14 at 20:01
  • WoW! voted down! Atleast my attempt deserved a reply for the voting down. Very irresponsible. – Abhishek Arora Sep 27 '14 at 11:54