开发者

NSTextField and controlTextDidEndEditing

I have a class 'EditingField' extending the NSTextField. The textfields are variables in my AppDelegate.

I wish to do something after the user has ended editing the textfield. Apparentl开发者_Python百科y i am to use the controlTextDidEndEditing or textFieldDidEndEditing. Which one am i to use?

Furthermore where exactly am i to implement the methods and how do i set a delegate if that is required?


If you're using NSTextField (i.e. are developing for OS X) then you'd use controlTextDidEndEditing. If you're using UITextField (i.e. are developing for iOS) then you'd be using textFieldDidEndEditing.

The delegate methods can be implemented in any class you wish, in a very small application perhaps even in the app delegate, otherwise you'd probably implement them in the controller responsible for the part of the UI containing the text field.

To set a delegate, use the setDelegate: method.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜