使用 Interface Builder 创建带有自己的 NIB 和 UIViewController 的子视图

发布于 2025-01-08 09:14:09 字数 303 浏览 6 评论 0原文

我想创建现有视图的子视图,其中子视图有自己的 XIB 文件和自己的 ViewController。我知道这只是以编程方式查看代码行,但我真的想学习如何更好地使用 Interface Builder。有谁知道如何在 XCode-4/Interface Builder 中执行此操作?

或者,换句话说,假设我创建了一个笔尖,其中包含我的主用户界面(假设为“main.xib”)。现在,我创建第二个视图 NIB“second.xib”,它链接到其自己的视图控制器(“secondViewController.m”)。如何告诉 IB 将第二个视图添加为 main.xib 中的子视图?

I would like to create a subview of an existing view, where the subview has its own XIB-file and its own ViewController. I know that is only a view lines of code programmatically, but I really want to learn how to use Interface Builder better. Does anybody know how to do this in XCode-4 / Interface Builder?

Or, stated differently, suppose I have created one nib with my main user interface in it (let's say "main.xib"). Now I create a second view NIB "second.xib", which is linked to its own viewcontroller ("secondViewController.m"). How do I tell IB to add the second view as a subview in the main.xib?

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

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

发布评论

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

评论(1

仄言 2025-01-15 09:14:09

如果我正确理解你的问题,你可以使用它自己的 xib 创建一个新的视图控制器或视图,然后返回到原始控制器的 xib,添加一个新的“子视图”并将子视图的类更改为该新的视图控制器。

但这只是您需要的一部分。恐怕IB没有办法完全做到这一点

If I understand your question correctly, you can make a new view controller or view, with it's own xib, and then go back to your original controller's xib, add a new "subview" and change the class of your subview to that new view controller.

But that's just a part of what you need. I'm afraid there is no way to do this completely with IB

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