Skip to content

Instantly share code, notes, and snippets.

@jglozano
Created February 26, 2012 17:27
Show Gist options
  • Save jglozano/1917862 to your computer and use it in GitHub Desktop.
Save jglozano/1917862 to your computer and use it in GitHub Desktop.
Correct way of making a UIWebView that takes full screen and handles the notification/resizing correctly
private UIWebView CreateWebView(NSUrlRequest urlRequest) {
var webView = new UIWebView(this.View.Bounds);
webView.AutosizesSubviews = true;
webView.AutoresizingMask = (UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth);
webView.LoadRequest(urlRequest);
webView.LoadError += (sender, e) => {
var view = sender as UIWebView;
view.LoadHtmlString("<html><body><h1>Oops!</h1></body></html>",null);
};
return webView;
}
@subdigital
Copy link

That will occupy 100% of the parent view's frame, yes.

@jglozano
Copy link
Author

sweet, that's what I was hoping! The app is going to be all mobile UI, I just need the native app to setup push notifications and other pieces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment