nsviewcontroller

Non-resizable window swift

非 Y 不嫁゛ 提交于 2019-11-26 21:23:49
问题 I have a NSViewController named Hardness , and I need not to let user resize it. Of course, I can just resize it back every time the users tries, but is there any way just not to let user open a window to full screen, or to stretch the window? 回答1: edit/update: Xcode 10.2 • Swift 5 NSWindow has a property called styleMask that allows you to control what kinds of control will be available to the user. If you don't want to allow the user to resize the window you have to remove the style mask

How to add NSViewController to a responder chain?

雨燕双飞 提交于 2019-11-26 20:45:36
问题 I'm having hard time understanding and finding info about how to make NSViewController accept key and mouse events. I read somewhere that in order to register these events in NSViewController it should be added to a responder chain, but I can't find the answer how to properly do this. Any kind of help is highly appreciated! 回答1: There's a nice tutorial found at CocoaWithLove.com. Summed up: you'll create a subclass of NSView (e.g. "EugeneView") and then that subclass will have some extra