I have a UIWebView that opens up a webpage in my app where a user can log in to their account. What I want the app to do is to change view controllers immediately after the user has logged into their account without seeing the next webpage in the webview. This is the code in my
viewDidLoad
function:
- (void)viewDidLoad {
[super viewDidLoad];
NSString *webpage = @"myfakewebpage.com";
self.defaults = [NSUserDefaults standardUserDefaults];
[self.activityIndicator startAnimating];
[self.myWebView setHidden:YES];
self.myWebView.delegate = self;
NSURL *myURL = [NSURL URLWithString:triggerPage];
self.myRequest = [NSURLRequest requestWithURL:myURL];
[self.myWebView loadRequest:self.myRequest];
}
And this is what my webViewDidFinishLoad
function looks like:
- (void)webViewDidFinishLoad:(UIWebView *)webView {
if ([self.activityIndicator isAnimating] == YES) {
[self.activityIndicator stopAnimating];
[self.activityIndicator setHidden:YES];
[self.myWebView setHidden:NO];
}
[self loadViewControllerAfterAuthentication];
}
[self loadViewControllerAfterAuthentication];
calls a function I built myself that will change the view controller through a poor workaround based on the response of the webpage after the user has authenticated. As of right now, the user can authenticate, but the next webpage will load for about half a second before my code kicks in and a new view controller is displayed. If anyone has an idea on how I can make the transition described above any smoother, that would be greatly appreciated.