开发者

How to tell when Cocoa MainMenu controls have been loaded

开发者 https://www.devze.com 2023-01-16 17:18 出处:网络
How can I tell when all of the MainMenu nib controls (primarily the main window) have been loaded?I want to display a sheet on top of the main window at launch, but when I put call beginSheet inside o

How can I tell when all of the MainMenu nib controls (primarily the main window) have been loaded? I want to display a sheet on top of the main window at launch, but when I put call beginSheet inside of awakeFromNib, I get an error because no windows have been开发者_JS百科 displayed yet: : kCGErrorIllegalArgument: _CGSFindSharedWindow: WID -1

How can this be fixed?


For this type of action, I'd suggest using the -applicationDidFinishLaunching delegate method. You'll implement this in your application delegate. Start the sheet from there and you're guaranteed that MainMenu.nib/xib is loaded by then.

0

精彩评论

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

关注公众号