views:

417

answers:

1

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?

+2  A: 

Refer to Apple documentation for UIControl. After initializing your textField, call addTarget:action:forControlEvents:

example for Value changed

[textField addTarget:self action:@selector(handleTouchValueChanged:) forControlEvents:UIControlEventValueChanged]
falconcreek
thanks, that worked
Mike