帮助Modal View Controller&登录 [英] Help with Modal View Controller & Login

查看:133
本文介绍了帮助Modal View Controller&登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一些帮助模式视图控制器,因为我以前没有使用Modal视图控制器...

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(@"Displaying the APP delegate");
[self.window makeKeyAndVisible];
return YES;

}

我有一个登录视图,标题为 LoginViewController 。我想要这首先显示为第一个视图,点击登录按钮(IBAction),我想显示 rootController.selectedIndex = 2 ;

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;

(请忽略目前的登录检查)。我只想让登录视图控制器出现在首先,如果我按登录,关闭本身,然后将屏幕到我的rootController(这是一个 UITabBarController

(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)

推荐答案

在tabBar的第一个视图的viewDidLoad方法中,模式视图如下:

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];

要关闭modalView,在登录按钮的IBAction中放入以下代码:

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

[self dismissModalViewControllerAnimated:YES];

这篇关于帮助Modal View Controller&登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆