• <legend id='pVxTt'><style id='pVxTt'><dir id='pVxTt'><q id='pVxTt'></q></dir></style></legend>

    <small id='pVxTt'></small><noframes id='pVxTt'>

  • <i id='pVxTt'><tr id='pVxTt'><dt id='pVxTt'><q id='pVxTt'><span id='pVxTt'><b id='pVxTt'><form id='pVxTt'><ins id='pVxTt'></ins><ul id='pVxTt'></ul><sub id='pVxTt'></sub></form><legend id='pVxTt'></legend><bdo id='pVxTt'><pre id='pVxTt'><center id='pVxTt'></center></pre></bdo></b><th id='pVxTt'></th></span></q></dt></tr></i><div id='pVxTt'><tfoot id='pVxTt'></tfoot><dl id='pVxTt'><fieldset id='pVxTt'></fieldset></dl></div>

  • <tfoot id='pVxTt'></tfoot>
      <bdo id='pVxTt'></bdo><ul id='pVxTt'></ul>

        调用 initWithNibName 不会初始化笔尖中的项目,它有 0x0

        calling initWithNibName doesn#39;t initialize items in the nib, it has 0x0(调用 initWithNibName 不会初始化笔尖中的项目,它有 0x0)
        <legend id='fGlpR'><style id='fGlpR'><dir id='fGlpR'><q id='fGlpR'></q></dir></style></legend>

      1. <small id='fGlpR'></small><noframes id='fGlpR'>

            <tfoot id='fGlpR'></tfoot>
                <i id='fGlpR'><tr id='fGlpR'><dt id='fGlpR'><q id='fGlpR'><span id='fGlpR'><b id='fGlpR'><form id='fGlpR'><ins id='fGlpR'></ins><ul id='fGlpR'></ul><sub id='fGlpR'></sub></form><legend id='fGlpR'></legend><bdo id='fGlpR'><pre id='fGlpR'><center id='fGlpR'></center></pre></bdo></b><th id='fGlpR'></th></span></q></dt></tr></i><div id='fGlpR'><tfoot id='fGlpR'></tfoot><dl id='fGlpR'><fieldset id='fGlpR'></fieldset></dl></div>
                  <tbody id='fGlpR'></tbody>
                • <bdo id='fGlpR'></bdo><ul id='fGlpR'></ul>
                • 本文介绍了调用 initWithNibName 不会初始化笔尖中的项目,它有 0x0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  当我打电话时:

                  self.viewController = [[DidItViewController alloc] initWithNibName:@"DidItViewController" bundle:nil];
                  

                  然后我在调试器中执行此行后立即检查self.viewController.navController,我发现它是空的(0x0).

                  and then I check self.viewController.navController right after this line is executed in the debugger, I find that it's empty (0x0).

                  在 DidItViewController 上,我将 navController 定义为:

                  On DidItViewController I have my navController defined as:

                  IBOutlet NavigationController *navController; 
                  

                  在我的 nib 文件中,我将 NavigationController 绑定到文件所有者(DidItViewController)上的这个 navController 属性.

                  and in my nib file I have the NavigationController bound to this navController property on the File Owner (a DidItViewController).

                  为什么我的 navController 没有被创建?有任何想法吗?我想我可能遗漏了一些关于 initWithNibName 工作方式的信息...

                  Why doesn't my navController get created? Any ideas? I think I may be missing something about the way initWithNibName works..

                  谢谢.

                  推荐答案

                  或者你可以使用 [NSBundle loadNibNamed:owner:options:] 方法代替.此方法可确保所有插座连接均已连接.(其中 [UIViewController initWithNibName: bundle:] 没有)

                  Or you can use [NSBundle loadNibNamed:owner:options:] method instead of. This method ensures all outlet connections connected. (which [UIViewController initWithNibName: bundle:] doesn't)

                  在这种情况下,NIB 中的 File's Owner 是 PhotoShow 类的外部实例.

                  In this case, File's Owner in the NIB is an external instance of PhotoShow class.

                  // This works completely. All outlets works.
                  PhotoShow* obj = [[PhotoShow alloc] init];
                  [[NSBundle mainBundle] loadNibNamed:@"PhotoShow" owner:obj options:nil];
                  // Outlets are always available at this moment.
                  
                  // This works. but does not connects outlets correctly sometimes.
                  PhooShow* obj = [[PhotoShow alloc] initWithNibName:@"PhotoShow" bundle:[NSBundle mainBundle]];
                  // Outlets may not available at this moment.
                  

                  参考文献选择

                  您可以使用此方法加载用户界面并使对象可用于您的代码.在加载过程中,此方法会取消归档每个对象,对其进行初始化,将其属性设置为其配置值,并重新建立与其他对象的任何连接.(为了建立outlet连接,该方法使用setValue:forKey:方法,可能会导致outlet中的对象被自动保留.)关于nib加载过程的详细信息,请参见资源编程指南.

                  Selection from reference document

                  You can use this method to load user interfaces and make the objects available to your code. During the loading process, this method unarchives each object, initializes it, sets its properties to their configured values, and reestablishes any connections to other objects. (To establish outlet connections, this method uses the setValue:forKey: method, which may cause the object in the outlet to be retained automatically.) For detailed information about the nib-loading process, see Resource Programming Guide.

                  这篇关于调用 initWithNibName 不会初始化笔尖中的项目,它有 0x0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  UINavigationController inside a UITabBarController inside a UISplitViewController presented modally on iPhone(UISplitViewController 内的 UITabBarController 内的 UINavigationController 以模态方式呈现在 iPhone 上) - IT屋-程序员软件开发技术分
                  ViewController in UINavigationController orientation change(UINavigationController 中的 ViewController 方向更改)
                  Custom back button in UINavigationController(UINavigationController 中的自定义后退按钮)
                  How to get the previous viewcontroller that pushed my current view(如何获取推送我当前视图的上一个视图控制器)
                  The correct way to set a light status bar text color in iOS 7 based on different ViewControllers(iOS 7中基于不同ViewControllers设置灯光状态栏文字颜色的正确方法)
                  Show UITabBar when UIViewController pushed(推送 UIViewController 时显示 UITabBar)

                  <tfoot id='TTor0'></tfoot>
                  • <legend id='TTor0'><style id='TTor0'><dir id='TTor0'><q id='TTor0'></q></dir></style></legend>
                      <i id='TTor0'><tr id='TTor0'><dt id='TTor0'><q id='TTor0'><span id='TTor0'><b id='TTor0'><form id='TTor0'><ins id='TTor0'></ins><ul id='TTor0'></ul><sub id='TTor0'></sub></form><legend id='TTor0'></legend><bdo id='TTor0'><pre id='TTor0'><center id='TTor0'></center></pre></bdo></b><th id='TTor0'></th></span></q></dt></tr></i><div id='TTor0'><tfoot id='TTor0'></tfoot><dl id='TTor0'><fieldset id='TTor0'></fieldset></dl></div>
                        <tbody id='TTor0'></tbody>

                        <small id='TTor0'></small><noframes id='TTor0'>

                          <bdo id='TTor0'></bdo><ul id='TTor0'></ul>