代码创建webview

原创
2012/03/01 16:52
阅读数 5W

- (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];

}

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部