开发者

Instantiate UITextField delegate programmatically?

开发者 https://www.devze.com 2022-12-30 20:43 出处:网络
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 dele

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

精彩评论

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