Reputation: 555
How can I make this code for a UIwebView 100% height and width?
UIWebView *webview=[[UIWebView alloc]initWithFrame:CGRectMake(0, 0, 1024,768)];
NSString *url=@"http://www.google.com";
NSURL *nsurl=[NSURL URLWithString:url];
NSURLRequest *nsrequest=[NSURLRequest requestWithURL:nsurl];
[webview loadRequest:nsrequest];
[self.view addSubview:webview];
Upvotes: 0
Views: 447
Reputation: 6790
When you make your frame use your current view's self.frame.size.width & self.view.frame.size.height instead of 1024 & 768.
UIWebView *webview=[[UIWebView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width,self.view.frame.size.height)];
Upvotes: 1