#import "AppDelegate.h"
@interface AppDelegate()
@property (weak) IBOutlet NSWindow *window;
@end
@implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application
}
- (void)applicationWillTerminate:(NSNotification *)aNotification {
// Insert code here to tear down your application
}
- (void)keyDown:(NSEvent *)theEvent {
//
}
- (IBAction)entrer:(NSTextField *)sender {
[super keyDown];
}
}
@end
我想打电话给该keydown方法之上,但我有一个错误 为NSObject的无可见接口声明的选择“的keyDown” 如何调用从entrer方法我空虚的keyDown方法?如何使用Cocoa调用keyDown方法?
'[self keyDown]'? – Sulthan
没有可见的NSObject接口声明选择器'keyDown',也可以在符号上点击' – MatR
',你会看到'keyDown:'是'NSResponder'类的一个方法。例如'NSWindow'和'NSView'对该方法做出响应,因为它们是'NSResponder'的子类。 NSObject不。 – vadian