Disable/Enable NSButton if NSTextfield is empty or not

后端 未结 4 2113
清歌不尽
清歌不尽 2021-02-08 01:05

I´m newbie with cocoa. I have a button and a textField in my app. I want the button disabled when the textfield is empty and enabled when the user type something.

Any po

4条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-08 01:34

    If you use controlTextDidChange instead of textDidChange, you can get rid of the notification stuff and just rely on being the NSTextField's delegate.

提交回复
热议问题