iPhone SDK - Add a quot;Add to Home Screenquot; button in a UIWebView(iPhone SDK - 添加“添加到主屏幕UIWebView 中的按钮)
问题描述
我有一个原生 iPhone 应用程序,它有一个 UIWebView
组件.我正在尝试查看是否可以复制 Safari 中标签栏选项中的添加到主屏幕"按钮.
I have a native iPhone app, which has a UIWebView
component to it. I am trying to see if I can replicate the "Add to Home Screen" button that is present in the tab bar options in Safari.
这可能在原生应用的 UIWebView
中实现吗?
Is this possible inside a UIWebView
within a native app?
谢谢!布雷特
推荐答案
[我想你的问题是关于复制与添加到主屏幕相关的操作,而不是复制按钮本身的外观(这是迂腐的就是你实际写的).]
[I presume your question is about replicating the action associated with add to home screen, rather than replicating the appearance of the button itself (which being pedantic is what you actually wrote).]
正如其他人所说,这是不可能的.
As others have said this isn't possible.
您可以做的是从您的应用程序中以编程方式启动 Safari,并为其提供要加载的页面的 URL,即您的页面.
What you could do is programatically launch Safari from within your app and give it the URL of a page to load which is your page.
当您的页面加载时,它会显示某种动画并向用户显示添加到主屏幕按钮的位置,并告诉他们在单击网页中显示的链接后按下它.当用户点击链接时,它会将他们带到您希望保存到桌面的任何页面,并且您希望他们按照您的指示进行操作.
When your page is loaded it has some sort of animation and shows the user where the add to home screen button is and tell them to press it after clicking a link which is displayed in your web page. When the users click on the link it takes them to whatever page it is that you would like saved to the desktop, and you hope they follow your instructions.
如果您注册您的应用以处理专有 url 方案,则用户可以通过单击使用您应用的 url 方案的链接从 Safari 中返回到您的应用.
If you register your app to handle a proprietary url scheme the users can get back to your app from within Safari by clicking on a link using your app's url scheme.
但是,您为 Safari 播种的网页必须是远程页面,您不能在您的应用程序包中为 Safari 提供一个页面,或者您的应用程序已下载,因为 Safari 无法从您的应用程序的沙箱中读取页面.
The web pages that you seed Safari with must however be remote pages, you cannot give Safari a page in your app's bundle or that your app has downloaded as Safari cannot read pages from your app's sandbox.
这篇关于iPhone SDK - 添加“添加到主屏幕"UIWebView 中的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:iPhone SDK - 添加“添加到主屏幕"UIWebView 中的按钮
基础教程推荐
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01