有没有人知道是否有任何开源解决方案使用UIWebview来构建一个完整的浏览器?在Three20中,当你传递一个URL时有类似于这样的东西,但我认为还有其他的选择。
我知道UIWebView是一个网络浏览器,但连接刷新、返回按钮、URL栏等需要额外的时间。
有什么建议吗?
有没有人知道是否有任何开源解决方案使用UIWebview来构建一个完整的浏览器?在Three20中,当你传递一个URL时有类似于这样的东西,但我认为还有其他的选择。
我知道UIWebView是一个网络浏览器,但连接刷新、返回按钮、URL栏等需要额外的时间。
有什么建议吗?
https://github.com/ghostery/banshee
编辑:该项目现在由此处维护:https://github.com/acatighera/banshee
它是一个带有选项卡、书签、搜索等功能的开源浏览器。
UIWebView
是一个完整的浏览器!要在webView
中打开一个url,你需要这样做 -
NSURL *url = [NSURL URLWithString:webAddress];
NSURLRequest *req = [NSURLRequest requestWithURL:url];
[webView loadRequest:req];
你甚至可以将 JavaScript 插入到 UIWebView
中。你可以按照自己的喜好进行定制。
//To customize the look & feel...
self.webView.scalesPageToFit = YES;
self.webView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
self.webView.autoresizesSubviews = YES;
//To insert Javascript
NSString *jsCommand = [NSString stringWithFormat:@"document.body.style.zoom = 0.5;"];
[self.webView stringByEvaluatingJavaScriptFromString:jsCommand];
-(IBAction)goForward:(id)sender
{
[webView goForward];
}
-(IBAction)goBack:(id)sender
{
[webView goBack];
}
-(IBAction) gotoHome:(id)sender
{
NSString *urlAddress = @"http://google.com";
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestObj];
}