Reputation: 9382
I have a really weird problem with a UIWebView.
I'm using it to login users to several services, I open the UIWebView, show a HTML login page, and pressing one of the textfields opens up the keyboard, as it should.
Afterwards, If i try loading a different login screen in it, pressing the input doesn't show the keyboard for some reason.
Did any of you ever run into this weird bug ? I tried checking for [self.window makeKeyAndVisible];
like i saw some recommend but it doesnt solve the problem unfortunately :(
This is how i load the UIWebView:
[webAuth stringByEvaluatingJavaScriptFromString:@"document.body.innerHTML = \"\";"];
[webAuth loadRequest: [NSURLRequest requestWithURL: [NSURL urlWithString:@"http://whatever"] ]];
First line is for clearing the page (tried removing it , it doesnt solve the keyboard problem)
Upvotes: 2
Views: 4419
Reputation: 9382
I'm writing this just in case someone else will ever come across this -
It seems what caused the problem was using SVProgressHUD to present a loader while the web pages load. I'm not sure how but when i comment them out everything works as expected.
Update: Sam has fixed the SVProgressHUD componenet and now it works with no issues on viewDidLoad
Upvotes: 1
Reputation: 5227
I'm really sorry if I missed something, but I can't reproduce your error. Could you maybe specify your setup in more detail? (I'd rather added this post as a comment, but don't have the reputation for it yet, sorry -.- please feel free to change this answer into a comment)
What I do:
I call the first website in the viewDidLoad
, which is the Facebook login
- (void)viewDidLoad {
[super viewDidLoad];
[self.webAuth stringByEvaluatingJavaScriptFromString:@"document.body.innerHTML = \"\";"];
[self.webAuth loadRequest: [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://facebook.com"]]];
}
I use the aforementioned button to call the second website, Twitter login
- (IBAction)showWebsite:(UIButton *)sender {
[self.webAuth stringByEvaluatingJavaScriptFromString:@"document.body.innerHTML = \"\";"];
[self.webAuth loadRequest: [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://twitter.com/#!/login"]]];
}
I login on Facebook, then press the button, and tap on any Twitter login input field
Upvotes: 2