Full screen and file version control support in the Mac App
In the Mac OS X 10.7 Lion, new users may be more useful features of the two features, a full-screen program, a file version control.
Foreword:
Full screen applications allows users to focus on a program, and hide the menu bar, the Dock, and other interface elements, making the work area to maximize use of limited screen space more effectively.
The file version control allows the user without the help of the Time Machine, Git or SVN these tools, you can easily restore files to a previously saved version to prevent some misuse delete important.
Full screen applications:
The full-screen feature allows the program to display in full screen mode, so users can have the largest operating area, and to hide has nothing to do with the program's visual elements.
In full screen mode, the Dock and menu bar will automatically hide, by the way to move the mouse to the edge of the screen to show the Dock or menu bar.
Full-screen program there is a problem in the case of using the dual-screen, a screen will not be able to use, can only display the background image, but can not use two screens, or a program full-screen in a separate screen.
In addition, full-screen program switching is to use the level of animation to switch for me may move too much, not very accustomed to, this is a digression.
To set up an App to support full-screen is very simple, just set the corresponding attribute of the Window's.
Full Screen has two modes, respectively for NSWindowCollectionBehaviorFullScreenPrimary and NSWindowCollectionBehaviorFullScreenAuxiliary, which most of the time only need use NSWindowCollectionBehaviorFullScreenPrimary can.
Set NSWindowCollectionBehaviorFullScreenPrimary, it will display a full screen button in the corresponding upper right corner of the Window, this button can switch the program to full screen mode
Full-screen mode menu:
Sometimes, in order to user easy to use, you need to set a shortcut key or menu for the user to toggle full-screen mode, then, only need add a NSMenuItem to to the main menu in the View menu, selector connection of First a Responder toggleFullScreen: can.
Cocoa runtime will automatically find the View menu selector for toggleFullScreen: menu items, and in accordance with the display of the current form to automatically update the menu titled Enter the Full Screen or Exit the Full Screen.
File version control:
For the average user in the Lion, a very useful feature is the file version control. In participation do not need the Time Machine does not need the Git, SVN, version control, you only need to support this function, you can directly retrieve previous versions of edited files.
Document version control, in fact, automatically save function at work, file version control, you only need the Mac App can automatically save the file version control will be the framework to do, no developer is too much involvement.
For the Mac App of the NSDocument based, to achieve the file is automatically saved, and under normal circumstances, the following methods only need the NSDocument the child class on the line:
+ (BOOL)autosavesInPlace {
return YES:
}
Of course, this is the Mac App, is to the NSDocument provide, such as - (an NSData *) dataOfType: (NSString *) typeName is sought error: (NSError **) outError - (NSFileWrapper *) fileWrapperOfType: (NSString *) typeName is sought error:(NSError **) outError, to save the contents of the file-based, rather than to write the contents of the file to disk, even in that case have autosaveInPlace not.