开发者

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];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜