开发者

How can I get the delegate?

开发者 https://www.devze.com 2023-01-25 17:19 出处:网络
In iOS to get the delegate I use following开发者_如何学Python code: AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication] 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

精彩评论

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