Automatic instance login for iPhone application development
The Automatic Login instance operation for iPhone application development is described in this article. The main content is the instance for automatic login. Let's take a look at the details.
There is a UITabBarController in the App. Before entering UITabBarController, you must verify whether the user has logged on. If not, a dialog box is displayed, asking the user to enter the login information.
Implementation Method
1. In appDelegate. Declare a variable in h to bind UITableController:
- UITabBarController * tabbarController;
2. In appDelegate. M to add the following method
- -(Void) applicationDidFinishLaunching :( UIApplication *) application {
-
- // Override point for customization after app launch
-
- [Window addSubview: tabbarController. view];
- [Window makeKeyAndVisible];}
-
- // Background image
- Window. backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed: @ "wallpaper.png"];
- [UIApplication sharedApplication]. statusBarHidden = NO;
- // If you have not logged on, execute the following method:
- LoginViewController * login = [[loginViewControlleralloc] initWithNibName: @ "loginViewController" bundle:
- [NSBundlemainBundle]; UINavigationController * nav = [[UINavigationControlleralloc] initWithRootViewController: login];
-
- [Self. tabbarControllersetModalTransitionStyle: UIModalTransitionStyleCoverVertical];
- [Self. tabbarControllerpresentModalViewController: nav animated: YES];
3. In the pop-up View's login execution method, the final execution method is as follows:
- -(IBAction) login
- {
- NSLog (@ "login press ");
- [SelfdismissModalViewControllerAnimated: YES];
- }