Skip to content

Instantly share code, notes, and snippets.

@joelmgallant
Created September 25, 2013 19:38
Show Gist options
  • Save joelmgallant/6704918 to your computer and use it in GitHub Desktop.
Save joelmgallant/6704918 to your computer and use it in GitHub Desktop.
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
NSLog(@"Webview load failed with error: %@", error);
if(error.code == NSURLErrorCancelled)
{
// [webView reload];
}
{
// fake like I've returned!
// Orient to Portrait & size to default...
[UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationPortrait;
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenWidth = screenRect.size.width;
CGFloat screenHeight = screenRect.size.height;
[_webview setTransform:CGAffineTransformFromUIOrientation(UIInterfaceOrientationPortrait)];
[_webview setCenter:CGPointMake(screenWidth/2, screenHeight/2)];
_webview.frame = self.view.bounds;
//Notify unity loading completed
UnitySendMessage("WebViewLoginMediator", "LoadComplete", "true");
return;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment