can't edit NSTextField in sheet at runtime

前端 未结 2 1031
粉色の甜心
粉色の甜心 2020-12-25 12:32

When clicking on a button, I\'d like to display a sheet with an email+password prompt with options to save and cancel. The UI is all set up, the actions are in place, and th

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-25 12:46

    The view does not absolutely have to have a title bar.

    See Why NSWindow without styleMask:NSTitledWindowMask can not be keyWindow?

    Which states: If you want a titleless window to be able to become a key window, you need to create a subclass of NSWindow and override -canBecomeKeyWindow as follows:

    - (BOOL)canBecomeKeyWindow {
        return YES;
    }
    

    This worked for me.

提交回复
热议问题