2016-09-21 40 views

回答

0
void getInputSource() { 
    TISInputSourceRef source = TISCopyCurrentKeyboardLayoutInputSource(); 
    NSLog(@"languages: %@", TISGetInputSourceProperty(source, kTISPropertyBundleID)); 
    NSLog(@"localized name: %@", TISGetInputSourceProperty(source, kTISPropertyLocalizedName)); 
    [self awakeFromNib]; 
} 

-(void) awakeFromNib { 
    self.statusBar = [[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength]; 
    NSImage* icon = [NSImage imageNamed:@"icon.png"]; 
    self.statusBar.image = icon; 
} 
0

当你调用myOther,通过自我引用。你应该像这样定义C方法:

void myOther(id callBack) 

现在你在c函数中有自引用。

void myOther(id callBack){ 
    [callBack myExample]; 
}