将视图控制器从根视图控制器推送到详细视图控制器(SplitView)
我的 splitview 包含 UITable (Masterview) 和每个 tabbaritem (Detailview) 上带有导航控制器的选项卡栏。我想要的是,当我单击 Masterview 中的表行时,它将在详细视图控制器中推送一个新视图。
我编写此迭代是为了获取正确的 UINavigationController 并推送新视图。不幸的是这不起作用。它不显示新视图,有时甚至会崩溃。
// 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];
知道我做错了什么吗? 任何帮助表示赞赏。提前致谢。
干杯, 伊诺尔
My splitview contains UITable (Masterview) and tabbar with navigationcontroller on each tabbaritem (Detailview). What I want to have is when I click on tablerow in Masterview, it will push a new view in detail view controller.
I wrote this iteration to get the right UINavigationController and push the new view. 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试
用这个替换:
因为
curController
已经是UINavigationController 类
的对象Try to replace
with this:
Because
curController
is already object ofUINavigationController class