• <small id='svNeH'></small><noframes id='svNeH'>

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

    1. <legend id='svNeH'><style id='svNeH'><dir id='svNeH'><q id='svNeH'></q></dir></style></legend>
      1. 在 AppDelegate 中调用函数?

        时间:2024-04-14

            <legend id='dGXUI'><style id='dGXUI'><dir id='dGXUI'><q id='dGXUI'></q></dir></style></legend>
            <tfoot id='dGXUI'></tfoot>
                  <tbody id='dGXUI'></tbody>
                • <bdo id='dGXUI'></bdo><ul id='dGXUI'></ul>

                • <small id='dGXUI'></small><noframes id='dGXUI'>

                  <i id='dGXUI'><tr id='dGXUI'><dt id='dGXUI'><q id='dGXUI'><span id='dGXUI'><b id='dGXUI'><form id='dGXUI'><ins id='dGXUI'></ins><ul id='dGXUI'></ul><sub id='dGXUI'></sub></form><legend id='dGXUI'></legend><bdo id='dGXUI'><pre id='dGXUI'><center id='dGXUI'></center></pre></bdo></b><th id='dGXUI'></th></span></q></dt></tr></i><div id='dGXUI'><tfoot id='dGXUI'></tfoot><dl id='dGXUI'><fieldset id='dGXUI'></fieldset></dl></div>
                  本文介绍了在 AppDelegate 中调用函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  按照 Cocos2d 中的 UITextField 示例中的解决方案(实际上是投票最高的答案),除了这条线,我设法做到了

                  Following the solution (the highest-voted answer actually) at UITextField Example in Cocos2d, I managed to do it except the line

                  [[[UIApplication sharedApplication] delegate] specifyStartLevel];
                  

                  我已将它放在我的场景中,我收到以下警告:

                  I have placed it in my scene, I get this warning:

                  找不到实例方法-specifyStartLevel"(返回类型默认为id")

                  这是为什么呢?我显然在我的 AppDelegate 的标头和实现中定义了 -specifyStartLevel ...

                  Why is that? I clearly have -specifyStartLevel defined in the header and implementation of my AppDelegate...

                  编辑:specifyStartLevel

                  #import <UIKit/UIKit.h>
                  
                  @class RootViewController;
                  
                  @interface AppDelegate : NSObject <UIApplicationDelegate,UITextFieldDelegate> {
                      UIWindow            *window;
                      UITextField *levelEntryTextField;
                      RootViewController  *viewController;
                  }
                  - (void)specifyStartLevel;
                  @property (nonatomic, retain) UIWindow *window;
                  
                  @end
                  

                  及实施:

                  - (void)specifyStartLevel
                  {
                      [levelEntryTextField setText:@""];
                      [window addSubview:levelEntryTextField];
                      [levelEntryTextField becomeFirstResponder];    
                  }
                  

                  推荐答案

                  现在,你的类对你的委托方法一无所知.您需要将您的委托导入您的实现,而不是您的接口(以避免循环导入).

                  Right now, your class doesn't know anything about your delegate's methods. You need to import your delegate into your implementation, not your interface (to avoid cycled imports).

                  例如,

                  #import "AppDelegate.h"
                  

                  然后您应该将嵌套方法调用中返回的委托转换为您的委托类型.例如:

                  Then you should cast the returned delegate in your nested method call to be your delegate type. For example:

                  [(AppDelegate *)[[UIApplication sharedApplication] delegate] specifyStartLevel];
                  

                  这篇关于在 AppDelegate 中调用函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:iOS 图像命名约定 下一篇:iOS 7 iAd cocos2d 已弃用

                  相关文章

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

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

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

                      <legend id='wvcAr'><style id='wvcAr'><dir id='wvcAr'><q id='wvcAr'></q></dir></style></legend>
                    1. <tfoot id='wvcAr'></tfoot>