带导航控制器的模态视图 [英] Modal View with Navigation Controller

查看:113
本文介绍了带导航控制器的模态视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

仍然无法弄清楚我做错了什么。只是尝试使用导航控制器获取模态视图。

still cannot figure out what I am doing wrong. Just trying to get a modal view with a navigation controller inside.

这是我的项目
http://www.matthewpateman.com/New.zip

任何人都可以告诉我我的意思做错了?我希望ShopModalView.xib在导航控制器中弹出,但它只是在空白页面上... ...

Can anybody tell me what I am doing wrong? I want "ShopModalView.xib" to pop up in the navigation controller, but its just diplaying a blank page…

推荐答案

介绍它作为模态视图并将控制器包装在导航控制器中以提供导​​航栏,以防您想要添加编辑,保存等按钮

Present it as a modal view and wrap the controller in a navigation controller to provide a navigation bar in case you want to add edit, save, etc buttons

ModalViewController *modalController = [[ModalViewController alloc] initWithNibName:@"ModalViewController" bundle:nil];
modalController.delegate = self; // Set any delegate you may have

// This is where you wrap the view up nicely in a navigation controller
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:modalController];

// You can even set the style of stuff before you show it
navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;

// And now you want to present the view in a modal fashion
[self presentModalViewController:navigationController animated:YES completion:nil];

这篇关于带导航控制器的模态视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆