0
votes

I am implementing a Cocoa application which supports the fullscreen mode. If the user quits while working on the fullscreen mode, I need to start the application in fullscreen mode,

While starting the application I check whether the application should start in fullscreen mode then call the toggleFullScreen: on NSWindow. Then the, application goes to the fullscreen mode and comes back to the normal window mode.

User can go to the full screen mode while working without any problem. Any tips on what's going wrong on this?

1
unable to understand, please explain, if possible attach gif or set of images for better understanding.Anoop Vaidya
Did some changes to the question , please have a lookrustylepord
fullScreen mode means the double diagonal arrow on top right corner or window?Anoop Vaidya
Yes , I am invoking that programmitaclly on application startup using "toggleFullScreen:" method on NSWindowrustylepord

1 Answers

1
votes

Make sure you really want to do this. Since Lion, there is a window restoration API that you should be using. See Any NSWindowRestoration examples? for how to use it. The caveat is that if "Close windows when quitting an application" in System Preferences is checked (which it is checked by default since 10.8), the window can only be restored upon reboot if the user chooses to do so.

If the user did not opt in for the window restoration setting throughout the OS across quitting applications, then generally you do not have to expect the window of your app to be restored for them. However, if you think you have a good reason otherwise, then I suggest invoking toggleFullScreen: after windowDidLoad: is called. I can only guess that you're calling it too soon and the window autosave might get in the way. It'd be helpful if you showed the relevant code.

Regardless, you should be implementing window restoration anyway and in the case of the window being restored by the API, you simply don't do anything.