一个强大的、功能齐全的 UIWebView 控制器实现?
我想将功能尽可能完整的嵌入式浏览器放入我的 iPhone 应用程序中。当用户从用户的个人资料视图中点击 URL 时,它就会被推送到 UINavigationController 上。
它应该:
拥有全套预期的浏览器控件和使用标准图标的加载状态指示器:后退、前进、加载旋转器、停止按钮、在 Safari 中打开按钮等。
通过警报弹出窗口正确处理网络和其他加载失败(取消/重试等)
尽可能智能地处理 mailto:// 和可能的其他非 http 链接
理想情况下,有一个可编辑的位置栏
响应所有界面方向
一般可以作为应用程序内的浏览器,而无需将用户发送到 Safari 应用程序。
UIWebView 本身需要很多帮助才能将所有这些修饰到位,并且我通过 Google 找到的所有在线教程都很粗略。另外,还有各种各样的陷阱(比如我通过艰难的方式发现的 mailto:// 链接问题等)
我希望不必在这里重新发明轮子来获得尽可能完整的浏览器。是否有我未能找到的开源实现?
谢谢!
I'd like to put as feature-complete of an embedded browser as possible into my iPhone app. It's just going to be pushed onto a UINavigationController when a user taps a URL from a user's profile view.
It should:
Have the full set of expected browser controls and loading status indicators using standard icons: back, forward, loading spinner, stop button, open in safari button, etc.
Properly handle networking and other loading failures with alert popups (cancel/retry etc)
Deal as intelligently as it can with mailto:// and possibly other non-http links
Ideally, have an editable location bar
Respond to all interface orientations
Generally be as a good as a browser can be in-app, without sending the user to the Safari app.
A UIWebView by itself needs a lot of help to get all these trimmings in place, and all the online tutorials I've found via Google are cursory. Plus there are variety of gotchas (like the mailto:// link issue which I found out about the hard way, etc.)
I'm hoping to not have to reinvent the wheel here to get as complete a browser as possible. Is there an open source implementation somewhere that I've failed to find?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“是否有我未能找到的开源实现?”据我所知没有。
要处理 mailto:// tel:// 您需要做的就是 UIWebView 委托,有一种方法
可以获取单击的 URL 的方案..如果它的 mailto:// 则执行某些操作,tel:// [[UIApplication shareApplication ] openURL:[NSURL URLWithString:@"tel://1-800-275-2273"]];
但 safari 与 UIWebView 仍然有很多不同。 UIWebView 无法直接处理弹出窗口。您可能想研究一下 http://niw.at/articles/2009/02/06/how-to-enable-the-popup-window-on-uiwebview/en 并且处理身份验证未内置到 UIWebView 中,这是一个破解 http://www.iphonedevsdk.com/forum/iphone-sdk-development/33944-http-basic-authentication-request-uiwebview.html iphonedevsdk.com/forum/iphone-sdk-development/33944-http-basic-authentication-request-uiwebview.html UIWebView 的其余部分您可以在任何地方找到教程。
"Is there an open source implementation somewhere that I've failed to find?" Not that I know of.
to handle mailto:// tel:// all you need to do is UIWebView delegate there is a method
you can get scheme of the clicked URL .. if its mailto:// then do something, tel:// [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://1-800-275-2273"]];
But still safari vs UIWebView is lots different. UIWebView cannot handle pop-ups directly. You might want to look into that http://niw.at/articles/2009/02/06/how-to-enable-the-popup-window-on-uiwebview/en and handling authentication is not built into UIWebView this is a hack http://www.iphonedevsdk.com/forum/iphone-sdk-development/33944-http-basic-authentication-request-uiwebview.html Rest of the UIWebView you can find a tutorial anywhere.