代码创建webview

- (void)viewDidLoad {

    [super viewDidLoad];

CGRect webFrame = CGRectMake(0.0,0.0,320.0,435.0);

webFrame.origin.y+=25;

UIWebView *webView = [[UIWebView alloc] initWithFrame:webFrame];

[webView setBackgroundColor:[UIColor redColor]];

webView.scalesPageToFit = YES;

NSString * urlAddress = @"http://www.agri-info.com.cn";

NSURL * url = [NSURL URLWithString:urlAddress];

NSURLRequest * requestObj = [NSURLRequest requestWithURL:url];

[webView loadRequest:requestObj];

[self.view addSubview:webView];

[webView release];

CGRect textFieldFrame = CGRectMake(,,self.view.bounds.size.width,23);

UITextField *urlField = [[UITextField alloc] initWithFrame:textFieldFrame];//输入框

urlField.borderStyle = UITextBorderStyleBezel;

urlField.textColor = [UIColor blackColor];

urlField.backgroundColor = [UIColor whiteColor];

[self.view addSubview:urlField];

[urlField release];

}

你可能感兴趣的:(代码创建webview)