[英]Push a view controller from root to detail view controller (SplitView)
My splitview contains UITable (Masterview) and tabbar with navigationcontroller on each tabbaritem (Detailview). 我的splitview包含UITable(Masterview)和带有导航控件的选项卡,每个选项卡上的选项卡(Detailview)。 What I want to have is when I click on tablerow in Masterview, it will push a new view in detail view controller.
我要拥有的是当我单击Masterview中的tablerow时,它将在详细视图控制器中推送一个新视图。
I wrote this iteration to get the right UINavigationController and push the new view. 我编写了此迭代以获取正确的UINavigationController并推送新视图。 Unfortunately this doesn't work.
不幸的是,这不起作用。 It doesn't show the new view and sometimes it just crashed.
它没有显示新视图,有时只是崩溃了。
// code from MasterView
PDFViewer *pdfViewerController = [[PDFViewer alloc] initWithNibName:@"PDFViewer" bundle:nil];
pdfViewerController.pdfData = [[NSData alloc] initWithData: pdfContent];
pdfViewerController.docInfo = curDocInfo;
// gets tabbar controllers
XtendisAppDelegate *appDelegate = (XtendisAppDelegate *)[[UIApplication sharedApplication] delegate];
NSMutableArray *controllers = [NSMutableArray arrayWithArray: appDelegate.tabBarController.viewControllers];
for (UIViewController *curController in controllers) {
if ([curController isKindOfClass:[UINavigationController class]]) {
[curController.navigationController pushViewController:pdfViewerController animated:YES];
break;
}
}
[pdfViewerController release];
Any idea what did i do wrong? 知道我做错了什么吗? Any help appreciated.
任何帮助表示赞赏。 Thank's in advance.
提前致谢。
Cheers, Inoel 干杯,Inoel
Try to replace 尝试更换
[curController.navigationController pushViewController:pdfViewerController animated:YES];
with this: 有了这个:
[curController pushViewController:pdfViewerController animated:YES];
Because curController
is already object of UINavigationController class
因为
curController
已经是UINavigationController class
对象
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.