Show initial view every time the application starts

For security reasons, I need the user to register every time my application opens. I would like to do this when the application is about to close reset it to its original view. I know from the view controller I can use the following code:

[[self navigationController] popToRootViewControllerAnimated:NO];

I am not sure how to adapt this to work with the application delegate.

In the original view, I have it set to display the modality of the input in viewDidLoad. It seems that this only works the first time, and not in the application when using the back button, so I hope that I will not use this method to display the login screen.

For clarification, I understand that I will do this in the application’s application, I’m looking for a specific bit of code that I can use to tell the application to reset the view.

+3
source share
4 answers

A simple solution to this would be to stop your application running in the background. This will completely disable your application when the user closes it.

I believe that for this you simply go to the info.plist of your project and check "Application does not work in the background" to "YES".

Good luck Hope this helps.

+2
source

In the AppDelegate.m application, you can use the following delegate method:

-(void)applicationWillResignActive: (UIApplication*)application

Check out the other methods UIApplicationDelegatehere and find out which one is best for your application:

http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIApplicationDelegate_Protocol/Reference/Reference.html


EDIT:

, , - -(void)applicationDidBecomeActive:(UIApplication *)application , .

, , , , , iOS5, , , , . , , , , .

, , , , , , . (. )

+1

You can configure it to display certain views in AppDelegate.

Take a look applicationDidBecomeActive:

0
source
    - (void)applicationDidBecomeActive:(UIApplication *)application
    {
        UINavigationController *navController = (UINavigationController *)self.window.rootViewController;
        [navController popToRootViewControllerAnimated:NO];
    }
0
source

All Articles