Skip to content

Instantly share code, notes, and snippets.

@sjg
Last active October 17, 2015 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sjg/70099957a1ccb75df683 to your computer and use it in GitHub Desktop.
Save sjg/70099957a1ccb75df683 to your computer and use it in GitHub Desktop.
Programatic WebView
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenWidth = screenRect.size.width;
CGFloat screenHeight = screenRect.size.height;
UIWebView *webview=[[UIWebView alloc]initWithFrame:CGRectMake(0, 0, screenWidth, screenHeight )];
NSString *url=@"https://google.com/";
NSURL *nsurl=[NSURL URLWithString:url];
NSURLRequest *nsrequest=[NSURLRequest requestWithURL:nsurl];
[webview loadRequest:nsrequest];
[self.view addSubview:webview];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment