Instantiate UITextField delegate programmatically?
I have a UITextField
that has been added to my view in Interface Builder. My question is: is there a way I can programatically set its delegate from within Xcode? I know that I can connect up the delegate in IB by dragging a connection from UITextField>Delegate
to my viewController which implements textFieldShouldReturn:
Just curious as the control "UIT开发者_StackOverflow中文版extField" is obviously instantiated in IB and not directly through code.
If you've got an IBOutlet to it, just use:
[theTextField setDelegate:aDelegate];
精彩评论