iPhone SDK - 添加“添加到主屏幕” UIWebView中的按钮 [英] iPhone SDK - Add a "Add to Home Screen" button in a UIWebView

查看:116
本文介绍了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?

谢谢!
Brett

Thanks! Brett

推荐答案

[我认为你的问题是复制与添加到主屏幕相关的动作,而不是复制按钮本身的外观(这是你实际写的迂腐)。]

[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方案,用户可以通过使用应用程序的网址方案单击链接从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中的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆