Keep window always on top?

后端 未结 3 1118
眼角桃花
眼角桃花 2020-11-29 01:45

In Objective-C for Cocoa Apps it\'s possible to use such way to keep window always on top?

How to achieve the same with Swift?

self.view.window?.leve         


        
3条回答
  •  南笙
    南笙 (楼主)
    2020-11-29 02:31

    I would prefer this way. This ignores all other active apps, and makes your app upfront.

        override func viewWillAppear() {            
            NSApplication.sharedApplication().activateIgnoringOtherApps(true)
        }
    

提交回复
热议问题