iPhone - 库 UINavigationController 和我的子类 UINavigationController 之间的区别
我试图理解在 Nib 内使用 UINavigationController(通过库窗口)和子类化 UINavigationController 之间的区别。 (就这个问题而言,我不仅仅专门指导航控制器;我指的是 Interface Builder 中的“库”窗口中包含的任何控制器。)
首先,我想我的第一个问题是:将库中的“控制器”添加到笔尖会创建该控制器的实例吗? 如果不是,这样做的目的或正常的最终目标是什么? 我很难找到任何材料能够真正解释 IB 的这一部分。 这是帮助说明我的问题的屏幕截图。
在我的 nib 窗口屏幕截图中,添加 UITabBarController
时会发生什么到笔尖? 这是否给了我一个 UITabBarController
的实例?
我的问题的最后一部分是(假设我最初的假设是正确的),为什么我要子类化 UITabBarController 类(在本例中)而不是将其添加到笔尖?
I'm trying to understand the difference between using a UINavigationController
inside a Nib (via the library window) and subclassing the UINavigationController
. (For the purposes of this question, I'm not just specifically referring to a Navigation Controller; I'm referring to any Controller that is contained in the Library window in Interface Builder.)
To start, I suppose my first question is: Does adding a 'Controller' from the library to a nib create an instance of that controller? If not, what is the purpose or the normal end goal in doing that. I've had trouble finding any material that truly explains that part of IB. Here is a screen shot to help illustrate my question.
In my screen shot of the nib window, what happens when I add the UITabBarController
to the nib? Does that give me an instances of a UITabBarController
?
The final part of my question is (assuming my initial assumption is correct), why would I subclass the UITabBarController
class (in this case) instead of adding it to the nib?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于你的第一个问题:是的,这确实创建了 UINavigationController 的实例。 然后,您必须将
UINavigationController
添加到 File's Owner 类,并将它们与IBOutlet
链接。然后在 Interface Builder 中 cntl+单击 File's Owner,拖动到构建器上的 Nav Controller,释放并选择 nav。
对于您问题的其余部分,问题是您是否需要对
UITabController
进行任何控制。For your first question: Yes that does create an instance of a
UINavigationController
. You must then add aUINavigationController
to the File's Owner class and link them with anIBOutlet
.then in Interface Builder cntl+click on File's Owner, drag to the Nav Controller on the builder, release, and select nav.
For the rest of your question the issue is wether or not you need any control of
UITabController
.