iOS:无法使用导航控制器显示视图

发布于 2024-11-18 21:25:42 字数 272 浏览 3 评论 0原文

我试图在我的导航控制器(iOS 4/Xcode 4)中显示从 NIB 加载的控制器,但它不起作用。 Interface Builder 不允许我选择任何笔尖;当我尝试手动键入一个时,我收到此错误:

警告:不支持的配置:导航控制器 NIB 名称设置为 MyViewController.nib (此视图控制器不打算以这种方式设置其视图)

这是怎么回事?需要注意的一件事:我在创建基于视图的项目后手动添加了导航控制器。我决定在创建项目后应该使用一个,而不是从一开始就选择基于导航。也许我忘记了一个设置?

I'm trying to display a controller loaded from a NIB in my navigation controller (iOS 4/Xcode 4), but it is not working. Interface Builder doesn't allow me to choose any of my nibs; when I try to manually type one I get this error:

warning: Unsupported Configuration: Navigation Controller NIB Name set to MyViewController.nib (This view controller is not intended to have its view set in this manner)

What's this all about? One thing to make note of: I manually added the Navigation Controller after creating a view-based project. I decided that I should use one after I had already created the project, instead of choosing Nav-based from the beginning. Perhaps I forgot a setting?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

这样的小城市 2024-11-25 21:25:42

我认为您正在尝试设置导航控制器本身的 NIB。

这不是您想要做的:您而是想要设置导航控制器的根视图控制器的笔尖。为此,您应该通过导航面板(左侧面板包含当前 NIB 中的所有对象的列表)展开导航控制器。

选择“根视图控制器”,然后根据需要设置其 NIB 和类。

您现在收到错误的原因是您实际上正在尝试设置导航控制器的 NIB,而 XCode 很正确地不允许您这样做。

I think you're trying to set the NIB of the navigation controller itself.

This is not what you want to do: you instead want to set the nib of the root view controller of your navigation controller. To do this, you should expand the navigation controller via the navigation panel (the left hand panel with a list of all the objects in your current NIB).

Selected 'Root View Controller', and then set its NIB and class as appropriate.

The reason you're getting an error right now is you're actually trying to set the navigation controller's NIB, which XCode is quite rightly not letting you do.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文