【发布时间】:2011-11-22 20:18:46
【问题描述】:
按照UITextField Example in Cocos2d 的解决方案(实际上是最高投票的答案),我设法做到了,除了这条线
[[[UIApplication sharedApplication] delegate] specifyStartLevel];
我已将它放在我的场景中,我收到以下警告:
找不到实例方法“-specifyStartLevel”(返回类型默认为“id”)
这是为什么呢?我显然在我的 AppDelegate 的标头和实现中定义了 -specifyStartLevel...
编辑: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];
}
【问题讨论】:
-
请提供specifyStartLevel的声明代码。
标签: objective-c cocos2d-iphone