Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS: Changing a view on backgroung does not refresh what is being seen before the app returns to foreground

Ok, I got this issue: I have an application with a login screen that is suposed to show everytime the app goes to background and return. The problem is, the previous screen appears for a fraction of second after the app return to foreground, because the system only refresh what is being seen after loading. What is need is a complete transition before the app returns to foreground. Yes, I am doing the transition on app delegate, at applicationDidEnterBackground. tried at every single other back/fore transition method, same results. The code works fine, but theres a flash of the screen before the login screen showing up.

The full code is as follows:

    - (void)applicationDidEnterBackground:(UIApplication *)application
       {               
           if (!([LogicCore loadPass] == nil || [[LogicCore loadPass] isEqualToString:@""])) //a password is set, 
           {
               [self.window.rootViewController dismissModalViewControllerAnimated:YES];//go back to the rootview, the login screen

           }
       }
like image 657
Stephen Lynx Avatar asked Feb 03 '26 06:02

Stephen Lynx


1 Answers

I forgot about this, but you can have your app exit when the user backgrounds it. The only real problem here is they see your splash screen again while the app loads.

To have your app exit when backgrounded (suspended) put the key "Application does not run in background" - raw key: UIApplicationExitsOnSuspend to YES.

Not an ideal solution, but the only one I can find at the moment.

like image 162
Sam Avatar answered Feb 04 '26 21:02

Sam



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!