Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 登录视图之前的模式视图屏幕_Objective C_Ios - Fatal编程技术网

Objective c 登录视图之前的模式视图屏幕

Objective c 登录视图之前的模式视图屏幕,objective-c,ios,Objective C,Ios,我是一个ios开发新手,我有一个关于如何向登录页面添加视图的问题。目前我有一个登录页面,我想做的是在登录页面可见之前,另一个模式视图应该在它前面,用户必须首先关闭它。如何将其添加到xcode中?这里有几个用于显示视图控制器的选项 - (IBAction)goToLoginView:(id)sender { //if you are using xibs use this line UIViewController *controller = [[UIViewControlle

我是一个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];
}

嗯,你怎么能在xcode中创建视图呢?。我似乎无法做到这一点,并获取所有三个.m、.h和.xib文件…@JohnBaum您想创建UIView还是UIViewController?我不确定两者的区别是什么。我想在应用程序加载到登录视图后创建一个弹出视图。因此,在login view.m文件中,我想启动一个欢迎对话框greeting@JohnBaum我提供的代码应该适合您的需要,我能想到的唯一一件事情就是UIAlertView,您可能正在谈论它的行为方式。