WEB开发网
开发学院手机开发iPhone 开发 iPhone 浏览器开发之关键 UIWebView 阅读

iPhone 浏览器开发之关键 UIWebView

 2010-03-24 16:20:00 来源:WEB开发网   
核心提示:NSLog(@"loading");UIView *contentView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];contentView.backgroundColor = [UIColor

NSLog(@"loading");

UIView *contentView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];

contentView.backgroundColor = [UIColor blueColor];

NSLog(@"self view");

// view orientation rotation

contentView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);

self.view = contentView;

//设置属性

//自动调整视图大小

self.view.autoresizesSubviews = NO;

//

//创建一个层用来放webview

CGRect webFrame = [[UIScreen mainScreen] applicationFrame];

webFrame.origin.y -= 20.0;

//

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

self.webView = aWebView;

//缩放

aWebView.scalesPageToFit = NO;

//自动调整大小

aWebView.autoresizesSubviews = NO;

aWebView.autoresizingMask=(UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth);

//[aWebView setDelegate:self];

NSURL *aURL = [NSURL URLWithString:@"http://192.168.1.120/emenu/?tp=tp4"];

NSURLRequest *aRequest = [NSURLRequest requestWithURL:aURL];

//发送请求

[aWebView loadRequest:aRequest];

//把webview添加到内容视图

[contentView addSubview:webView];

[aWebView release];

[contentView release];

Tags:iPhone 浏览器 开发

编辑录入:coldstar [复制链接] [打 印]
赞助商链接