开发者

Help with Modal View Controller & Login

开发者 https://www.devze.com 2023-03-14 14:09 出处:网络
I need some help with modal view controllers, as I have not used Modal View Controllers before... So this is how my application now is...

I need some help with modal view controllers, as I have not used Modal View Controllers before...

So this is how my application now is...

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.

[_window addSubview:rootController.view];
rootController.selectedIndex =2;
 NSLog(@"Dis开发者_JS百科playing the APP delegate");
[self.window makeKeyAndVisible];
return YES;

}

I have a view for Login, titled LoginViewController . I want this to appear first as the first view, and on clicking the Login button (IBAction), I want it to show rootController.selectedIndex =2;

(Please ignore the login check as of now). I just want the login view controller to appear at first, and dismiss itself if I press Login, and then take the screen to my rootController (which is a UITabBarController)


In the viewDidLoad method of the first view in the tabBar present the modal view as follows :

LoginViewController *lvc = [[LoginViewController alloc]initWithNibName:@"LoginViewController" bundle:[NSBundle mainBundle]];

[self presentModalViewController:lvc animated:YES];

[lvc release];

To dismiss the modalView, in the IBAction of the login button just put in the following code :

[self dismissModalViewControllerAnimated:YES];
0

精彩评论

暂无评论...
验证码 换一张
取 消