Listen to a value change of my text field

前端 未结 4 1070
既然无缘
既然无缘 2020-12-01 16:47

I\'m trying to understand how to catch a \"text changed\" event from a text field in my window. I\'m used to Java\'s \"action listeners\", and can\'t find anything similar i

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-01 16:49

    You can use textFieldShouldBeginEditing: method of UITextFieldDelegate. In iOS listeners are called NSNotifications

    EDIT

    In objective-c a lot of UIObjects have a corresponding protocol class that's called "delegate" The delegate is responsible for reacting to events. So to be able to respond or to be notified about actions you need to implement the delegate and its methods.

提交回复
热议问题