CGRect webFrame = [[UIScreen mainScreen] applicationFrame]; webFrame.origin.y += kTopMargin + 5.0; // leave from the URL input field and its label webFrame.size.height -= 40.0; myWebView = [[UIWebView alloc] initWithFrame:webFrame]; myWebView.backgroundColor = [UIColor whiteColor]; myWebView.scalesPageToFit = YES; myWebView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); myWebView.delegate = self; [self.view addSubview: myWebView]; CGRect textFieldFrame = CGRectMake(kLeftMargin, kTweenMargin, self.view.bounds.size.width - (kLeftMargin * 2.0), kTextFieldHeight); urlField = [[UITextField alloc] initWithFrame:textFieldFrame]; urlField.borderStyle = UITextBorderStyleBezel; urlField.textColor = [UIColor blackColor]; urlField.delegate = self; urlField.placeholder = @"<enter a URL>"; urlField.text = @"http://www.apple.com"; urlField.backgroundColor = [UIColor whiteColor]; urlField.autoresizingMask = UIViewAutoresizingFlexibleWidth; urlField.returnKeyType = UIReturnKeyGo; urlField.keyboardType = UIKeyboardTypeURL; // this makes the keyboard more friendly for typing URLs urlField.autocorrectionType = UITextAutocorrectionTypeNo; // we don't like autocompletion while typing urlField.clearButtonMode = UITextFieldViewModeAlways; [self.view addSubview:urlField]; [myWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.apple.com"]]];