I'm working on the UIWebView and what I want is for the webView not to over rap the view.
so here is the question. I set the UIWebView ,and the status bar is overlaid over the content. How can I handle this? I coded as when I made the UIImage view, but at that time there is the navigation bar, and it worked well.
Also I did setFrame:CGRectMake(0, 20).... but also doesn't work. why the [ setFrame]; method doesn't work? Any ideas please.
#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIWebView *webView;
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleDefault];
[self.webView setFrame:CGRectMake(0,0, self.view.frame.size.width, self.view.frame.size.height)];
NSURL *myURL = [NSURL URLWithString:@"http://www.amazon.com"];
NSURLRequest *myURLReq = [NSURLRequest requestWithURL:myURL];
[self.webView loadRequest:myURLReq];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(void)webViewDidStartLoad:(UIWebView *)webView{
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
}
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}
@end
UPDATE: I switched off the Auto-layout and change setFrame:CGRectMake(0, 20) and now they are not overlaid. But I wonder why we need to set this? If I set the status bar translucent , it makes sense. But I set it as the default, which is supposed to start to draw the screen right below the status bar at (0,20).
Add following code in your viewDidLoadMethod :
Try this one
}
Your autosize masks should look like this.
Final Output: