Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/109.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.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
Ios 从类别内显示模态VC_Ios_Uitabbarcontroller_Uialertview_Categories - Fatal编程技术网

Ios 从类别内显示模态VC

Ios 从类别内显示模态VC,ios,uitabbarcontroller,uialertview,categories,Ios,Uitabbarcontroller,Uialertview,Categories,我有一个从nsMangeObject子类分支出来的类别。它处理核心数据对象的创建和删除 在我的创建方法中,我向用户显示一个UIAlert,询问他们是否要配置新对象。响应UIAlert的代理属于同一类别 我想从这里把配置对话框推到屏幕上。最好的方法是什么。我的整个应用程序是基于UITabBarController的 这看起来对吗 -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex

我有一个从nsMangeObject子类分支出来的类别。它处理核心数据对象的创建和删除

在我的创建方法中,我向用户显示一个UIAlert,询问他们是否要配置新对象。响应UIAlert的代理属于同一类别

我想从这里把配置对话框推到屏幕上。最好的方法是什么。我的整个应用程序是基于UITabBarController的

这看起来对吗

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
    AppDelegate *dc = [[UIApplication sharedApplication]delegate];

    //push the Configuration dialog to the screen from here
    NewVC *newVC = [[NewVC alloc]initWithNibName:@"New VC" bundle:nil];

    [dc.tabBarController presentViewController:newVC animated:YES completion:nil];
}

您应该让您的视图控制器成为该
UIAlertView
的代理,并从那里展示您的模式。因此,
点击按钮索引
应该被移动到视图控制器的代码中。

啊,这很有趣。那么在哪里实例化视图控制器呢?在显示警报之前?视图控制器是您正在其中创建新的
NSManagedObject
的控制器。这是您的可视视图控制器。哦,好吧,我没有提到的是后台运行的守护进程能够添加这些新的NSManagedObject。我知道,没有特定的UI能够添加这些对象(通过蓝牙硬件触发)。然后我假设你有一个选项卡栏控制器,它总是可见的。我建议您将其子类化,并使其成为行动表的委托。在它的子类中,您可以实现
clickedbuttonationindex
方法,并从中显示模式。