Hi, I'm all new here.
Currently I'm having same problem as you guys, and the search turns me here.
I don't know if any of you have figured it out or not, but after some work around, I can make it work. It's not the idea solution, but it solved my needs. So I will put it here in case some one find it helpful.
The trick is to catch event KeyBoardWillShow, and use advantage of SecuredText property of UITextField.
The idea is simple: firstly you set textfield as securedText in viewDidLoad:
[yourTextField setSecureTextEntry:YES];
Then when keyboard shows up, you set it back to not secure, then keyboard will always be English (or at least, latin character keyboard).
Here are the steps:
- (void) keyboardWillShow;
{
[textField setSecureTextEntry:NO];
}
- (void)viewDidLoad
{
[textField setSecureTextEntry:YES];
//add observer
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
[center addObserver:self selector:@selector(keyboardWillShow) name:UIKeyboardWillShowNotification object:nil];
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}
Simple enough.!
If you guys have other ways around, then I'm happy to learn it.
Edit: don't forget to remove observer when you're done with it, Or just do the clean up in viewDidUnload method:
- (void)viewDidUnload
{
[super viewDidUnload];
[[NSNotificationCenter defaultCenter]removeObserver:self];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
Last edited by tiendat26; 10-07-2011 at 03:20 AM.
Reason: Add remove observer part
|