开发者

focus on UITextField

I am doing a login page, whereby if the user press the login button without filling up the username/password, an alertview will pop up. How do I focus on the textfield and bring up the keyb开发者_Python百科oard accordingly after the user dismiss the alertview?

What is the method to call to set focus on a particular UITextField? Thanks!


Make sure your UIAlertView's delegate is your view controller (self), and in the implementation of the UIAlertView delegate method alertView:clickedButtonAtIndex:, call [usernameTextField becomeFirstResponder]. Easy! (Make sure your view controller class adopts the UIAlertViewDelegate protocol.)


[myTextField becomeFirstResponder];


You should use a code [mytextField becomeFirstResponder]; in your – alertView:clickedButtonAtIndex: delegate method.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜