[英]Modal view screen before login view
I am a newbie ios developer and i had a question on how to add a view to a login page. 我是一名新手ios开发人员,我对如何向登录页面添加视图有疑问。 Currently i have a login page and what i want to do is before the login page is visible, another modal view should preceed it that the user must first dismiss.
目前,我有一个登录页面,我想做的是在登录页面可见之前,另一个模态视图应使用户必须先将其关闭。 How can i add this in xcode?
如何在xcode中添加此内容?
Here's a couple options for presenting a view controller. 这是呈现视图控制器的几个选项。
- (IBAction)goToLoginView:(id)sender
{
//if you are using xibs use this line
UIViewController *controller = [[UIViewController alloc] initWithNibName:@"myXib" bundle:[NSBundle mainBundle]];
//if you are using storyboards use this line
UIViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"myViewControllersID"];
//to present the controller modally use this
[self presentViewController:controller animated:YES completion:nil];
//or if you are pushing to this controller using a navigation controller use this
[self.navigationController pushViewController:controller animated:YES];
}
Then to dismiss a view controller use this: 然后使用以下命令关闭视图控制器:
- (IBAction)closeMyController
{
//if the view was presented modally close it with this
[self dismissViewControllerAnimated:YES completion:nil];
//and to pop back up the navigation stack
[self.navigationController popToRootViewControllerAnimated:YES];
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.