繁体   English   中英

登录视图之前的模态视图屏幕

[英]Modal view screen before login view

我是一名新手ios开发人员,我对如何向登录页面添加视图有疑问。 目前,我有一个登录页面,我想做的是在登录页面可见之前,另一个模态视图应使用户必须先将其关闭。 如何在xcode中添加此内容?

这是呈现视图控制器的几个选项。

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

然后使用以下命令关闭视图控制器:

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM