Skip to content

Instantly share code, notes, and snippets.

@bitwit
Created February 4, 2013 01:18
Show Gist options
  • Save bitwit/4704528 to your computer and use it in GitHub Desktop.
Save bitwit/4704528 to your computer and use it in GitHub Desktop.
The Objective-C ViewController from my blog entry An iOS5 Ready Native Web App Template http://www.bitwit.ca/blog/an-ios5-ready-native-web-app-template/
#import <UIKit/UIKit.h>
#import "WebViewController.h"
@interface ViewController : WebViewController
@end
#import "ViewController.h"
@implementation ViewController
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
#pragma mark - View lifecycle
/* We are ready to load a page using our new webview functionality */
- (void)viewDidLoad
{
[super viewDidLoad];
[self loadPageFromFile:@"index.html"];
//[self loadPageWithURL:@"http://www.google.ca"];
}
- (void)viewDidUnload
{
[super viewDidUnload];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
} else {
return YES;
}
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment