When I create UITextField inside Interface Builder, I can access Events tab for it, which has events like Value changed, Touch cancel, Touch drag, etc. I can assign my own methods to every of those events. How can I do the same, when I create UITextField programmatically with alloc?
Refer to Apple documentation for UIControl
. After initializing your textField
, call addTarget:action:forControlEvents:
example for the touch event ending an edit session
[textField addTarget:self action:@selector(handleTouchValueChanged:) forControlEvents: UIControlEventEditingDidEnd]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With