Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/114.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 如何在TabBar iOS应用程序中实现模式视图_Objective C_Ios_Cocoa Touch_Modalviewcontroller_Presentmodalviewcontroller - Fatal编程技术网

Objective c 如何在TabBar iOS应用程序中实现模式视图

Objective c 如何在TabBar iOS应用程序中实现模式视图,objective-c,ios,cocoa-touch,modalviewcontroller,presentmodalviewcontroller,Objective C,Ios,Cocoa Touch,Modalviewcontroller,Presentmodalviewcontroller,我正在尝试在tabbar应用程序中显示模式视图。我正在使用代码 - (IBAction)newView { [self.viewController presentModalViewController:viewController animated:YES]; } 链接到一个按钮。按下按钮时,不会发生任何事情,日志上也不会显示任何内容。这很可能很容易修复,但我还没有发现任何有效的方法 谢谢使用这个,你会摇滚起

我正在尝试在tabbar应用程序中显示模式视图。我正在使用代码

- (IBAction)newView
{
 [self.viewController presentModalViewController:viewController 
                                        animated:YES];
}
链接到一个按钮。按下按钮时,不会发生任何事情,日志上也不会显示任何内容。这很可能很容易修复,但我还没有发现任何有效的方法

谢谢

使用这个,你会摇滚起来:

[self presentModalViewController:viewController animated:YES];

如果不提供更多的代码和上下文,就很难判断出哪里出了问题。“self”属于哪一类,“viewController”是UITabBarController吗?谢谢。我不熟悉使用模态视图,所以也许你可以帮我:使用新代码,我的应用程序在运行操作时会崩溃。这是日志消息:由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因是:“应用程序试图在目标上呈现一个无模式视图控制器。感谢您的帮助。您必须首先初始化viewcontroller:viewcontroller=[[myViewControllerClass alloc]init];