How do I create a custom borderless NSWindow in Objective-C + Cocoa?

吃可爱长大的小学妹 提交于 2019-12-04 10:09:01

As explained in this answer, windows without title or resize bar (including borderless windows) cannot become key windows.

You were right about overriding -canBecomeKeyWindow, but you’ve missed the correct place. You shouldn’t do it in your application delegate. You need to create an NSWindow subclass and then override that method.

This sample code of apple should give you the information you need, its really easy to change the way it works and change it into your own drawn NSWindow ( without a border :D )

http://developer.apple.com/library/mac/#samplecode/RoundTransparentWindow/Introduction/Intro.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!