How to get Main Window (App Delegate) from other class (subclass of NSViewController)?

后端 未结 3 1918
情书的邮戳
情书的邮戳 2020-12-23 22:01

I\'m trying to change my windows content, from other class , that is subclass of NSViewController.I\'m trying code below, but it doesn\'t do anything.

[NSApp         


        
3条回答
  •  醉梦人生
    2020-12-23 22:36

    If the window property isn't set yet, try delaying things until the app has finished loading, like so:

    [myObject performSelector:@selector(theSelector) withObject:nil afterDelay:0.1];
    

提交回复
热议问题