开发者

How to tell when Cocoa MainMenu controls have been loaded

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜