IPhone applicationsDevelopmentAutomatic LoginInstance operations are the content to be introduced in this article. The main content is implementationAutomatic LogonLet's 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];
- }
Summary:IPhone applicationsDevelopmentAutomatic LoginThe instance operation is complete.Automatic LogonIf you have learned a lot, I hope this article will help you.