开发者

How can I get the delegate?

In iOS to get the delegate I use following开发者_如何学Python code:

AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication] delegate];

How to get the delegate in Cocoa Mac programming?


AppDelegate *appDelegate = (AppDelegate *)[NSApp delegate];

see the docs for NSApplication for more info.


In Swift 5

let delegate = (NSApplication.shared.delegate) as! AppDelegate
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜