使用 Interface Builder 创建带有自己的 NIB 和 UIViewController 的子视图
我想创建现有视图的子视图,其中子视图有自己的 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我正确理解你的问题,你可以使用它自己的 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