Skip to content

Instantly share code, notes, and snippets.

@mwbrooks
Created April 22, 2010 07:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mwbrooks/374922 to your computer and use it in GitHub Desktop.
Save mwbrooks/374922 to your computer and use it in GitHub Desktop.
PhoneGap-iPhone Viewport Issue
//
// A quick and dirty fix to issue #51
//
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
CGRect windowFrame = [ [ UIScreen mainScreen ] bounds ];
CGRect webViewFrame = [ [ UIScreen mainScreen ] applicationFrame ];
webViewFrame.origin = windowFrame.origin;
self.window = [ [ [ UIWindow alloc ] initWithFrame:windowFrame ] autorelease ];
self.window.autoresizesSubviews = YES;
viewController = [ [ PhoneGapViewController alloc ] init ];
webView = [ [ UIWebView alloc ] initWithFrame:webViewFrame ];
[webView setAutoresizingMask: (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight) ];
[ viewController setWebView:webView ];
[ viewController.view addSubview:webView ];
// The remainder of the method can remain untouched...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment