1.首先要先建立一个全屏的窗口
//获取窗口控制器
NSStoryboard *storyboard = [NSStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
WallpaperWindowController *wwc = [storyboard instantiateControllerWithIdentifier:@"AboutWindowController"];
//获取当前所有屏幕,你可能有多个显示器
NSArray(NSScreen * ) * screens = [NSScreen screens];
//设置为全屏窗口
CGRect rect = CGRectMake(screen.frame.origin.x, screen.frame.origin.y, screen.frame.size.width, screen.frame.size.height);
[self.window setFrame:rect display:YES animate:NO];
[self.window makeKeyAndOrderFront:nil];
2.设置窗口层级
//设置与桌面同级别
[self.window setLevel:kCGDesktopWindowLevel];
3.设置跟随工作空间显示
[self.window setCollectionBehavior:(NSWindowCollectionBehaviorCanJoinAllSpaces | NSWindowCollectionBehaviorStationary | NSWindowCollectionBehaviorIgnoresCycle)];