Ability to Hit Enter on iPad
I want enter(Go.... etc) button on my iPad keypad. So that when I hit enter button on iPad keypad after entering username & password it should login & open next screen. I mean no need to press login button which I have design on my app. I have html pages in my application & I am able to hit Go,Searc开发者_C百科h, refresh button by default. I want same Go button for iPad in Objective-C, Xcode framework. Only return button I can view by default on iPad, xcode framework . Can someone help me.....It can be easy one but I didnt found any code for the same.
It isn't hard at all.
Go into Interface Builder and open the current XIB you have placed the UITextField (I'm assuming).
What you want to do is, in the UITextField's property, is change the Return Key value to "Go" or whatever it is you want. I'm assuming you've already built the code for it to detect what UITextField is being edited and when the return key is tapped, what to do?
EDIT
Make sure that your UITextField's are delegated to the current ViewController. Then implement a delegate method. The following.
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
if (textField == emailInput) {
[emailInput resignFirstResponder];
[passwordInput becomeFirstResponder];
} if (textField == passwordInput) {
[passwordInput resignFirstResponder];
[self performSelector:@selector(userLogin)];
}
return 0;
}
Therefore, when the emailInput's return key is hit, we jump to the passwordInput. When the passwordInput's return key is then hit, we perform a selector that issues the user login.
精彩评论