• <tfoot id='57ZjE'></tfoot>

    <small id='57ZjE'></small><noframes id='57ZjE'>

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

    2. <legend id='57ZjE'><style id='57ZjE'><dir id='57ZjE'><q id='57ZjE'></q></dir></style></legend>

          <bdo id='57ZjE'></bdo><ul id='57ZjE'></ul>
      1. 获取对 UIApplication 委托的引用

        时间:2023-09-12
            <i id='ih4EC'><tr id='ih4EC'><dt id='ih4EC'><q id='ih4EC'><span id='ih4EC'><b id='ih4EC'><form id='ih4EC'><ins id='ih4EC'></ins><ul id='ih4EC'></ul><sub id='ih4EC'></sub></form><legend id='ih4EC'></legend><bdo id='ih4EC'><pre id='ih4EC'><center id='ih4EC'></center></pre></bdo></b><th id='ih4EC'></th></span></q></dt></tr></i><div id='ih4EC'><tfoot id='ih4EC'></tfoot><dl id='ih4EC'><fieldset id='ih4EC'></fieldset></dl></div>

                <bdo id='ih4EC'></bdo><ul id='ih4EC'></ul>
              • <small id='ih4EC'></small><noframes id='ih4EC'>

                    <tbody id='ih4EC'></tbody>
                  <legend id='ih4EC'><style id='ih4EC'><dir id='ih4EC'><q id='ih4EC'></q></dir></style></legend>
                  <tfoot id='ih4EC'></tfoot>
                  本文介绍了获取对 UIApplication 委托的引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在编写我的第一个 iPhone 应用程序,但在切换视图时遇到了问题.我在 AppDelegate(UIApplicationDelegate 的一个实例)中有 2 个视图和对每个视图的引用.我在 applicationDidFinishLaunching 中创建了这两个实例并立即显示第一个视图.这工作正常.

                  I'm writing my first iPhone application and I'm having trouble switching views. I have 2 views and a reference to each in the AppDelegate (an instance of UIApplicationDelegate). I create instances of both in the applicationDidFinishLaunching and immediately show the first view. This works fine.

                  问题是对另一个视图的引用在 AppDelegate 中,我不知道如何获取对它的引用,因此我可以切换到另一个视图.有没有办法获得对主要 UIApplicationUIApplicationDelegate 对象的引用?

                  The problem is the reference to the other view is in the AppDelegate and I can't figure out how to get a reference to it so I can switch to the other view. Is there a way to get a reference to the main UIApplication or UIApplicationDelegate objects?

                  推荐答案

                  是的,UIApplication 是一个单例,并且使用了 Objective-C 的普通单例模式:

                  Yes, UIApplication is a singleton, and uses the normal singleton pattern for Objective-C:

                  [UIApplication sharedApplication];
                  

                  您可以直接从中获取您的委托类:

                  You can get your delegate class directly from it:

                  MyAppDelegate *delegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate];
                  

                  这篇关于获取对 UIApplication 委托的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:每个对象有多个代表? 下一篇:“代表"的替代方案是什么?在控制器之间传递数据?

                  相关文章

                  <legend id='eazuY'><style id='eazuY'><dir id='eazuY'><q id='eazuY'></q></dir></style></legend>

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

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

                  1. <tfoot id='eazuY'></tfoot>
                    • <bdo id='eazuY'></bdo><ul id='eazuY'></ul>