I want to place an icon on the iPhone screen form my application, like placing an icon and if i will touch that icon it will do the desired operation, like opening a sound file or an image.
我想在我的应用程序的iPhone屏幕上放置一个图标,比如放置一个图标,如果我将触摸该图标,它将执行所需的操作,如打开声音文件或图像。
So i want to ask is it possible to place an icon on screen through an application and do some events on it.
所以我想问一下,是否可以通过应用程序在屏幕上放置一个图标并在其上执行一些事件。
Regards, Vishal
5 个解决方案
#1
You can't do that. The only icon that will appear on the iPhone home screen will be the icon for your application itself.
你不能这样做。 iPhone主屏幕上显示的唯一图标将是应用程序本身的图标。
Edit:
Expanding on the web shortcut idea suggested by Gene, it might be possible you achieve what you want by having a web short cut using a specific protocol handler to open your app with a web short cut added to the home screen. Take a look at this article:
扩展了Gene建议的Web快捷方式,您可以通过使用特定协议处理程序进行Web快捷方式来实现您想要的功能,通过添加到主屏幕的Web快捷方式打开您的应用程序。看看这篇文章:
http://www.mobileorchard.com/apple-approved-iphone-inter-process-communication/
I believe that would still require the user to add the shortcut though, I don't think a third party app can add web shortcuts.
我相信仍然需要用户添加快捷方式,我不认为第三方应用可以添加网页快捷方式。
#2
I found it annoying that google maps cannot be page bookmarked onto the home screen. Here is an almost quick solution:
我发现谷歌地图不能被页面标记到主屏幕上令人讨厌。这是一个几乎快速的解决方案:
-
Create a Tiny URL of the target Google Map. SF Bay Area Traffic is http://maps.google.com/maps?hl=en&ie=UTF8&ll=37.55111,-122.121277&spn=0.810034,1.182404&z=10&layer=t
创建目标Google地图的微小网址。旧金山湾区交通是http://maps.google.com/maps?hl=en&ie=UTF8&ll=37.55111,-122.121277&spn=0.810034,1.182404&z=10&layer=t
-
Mail yourself the Tiny URL.
邮寄自己的小网址。
-
Select the URL in the email application.
在电子邮件应用程序中选择URL。
-
Before Safari realizes that it is a Google Map url, touch the x on the url line to cancel the transfer to the Google Map App.
在Safari意识到它是Google地图网址之前,请触摸网址行上的x以取消转移到Google地图应用。
-
Touch the + at the bottom of Safari and touch "Add to Home Screen"
触摸Safari底部的+,然后触摸“添加到主屏幕”
Name it appropriately and, there you have it, a Google Map entry on your home screen.
为它命名,并在主屏幕上显示Google Map条目。
#3
Andynormancx is correct. The only exception to this rule (that I know of) is a web shortcut -- within Mobile Safari, you can select "add to home screen", and a shortcut to the bookmarked page will appear on Springboard. The icon is a partial screenshot of the web page.
Andynormancx是对的。此规则(我知道)的唯一例外是Web快捷方式 - 在Mobile Safari中,您可以选择“添加到主屏幕”,并且Springboard上将显示已添加书签的页面的快捷方式。该图标是网页的部分屏幕截图。
I don't know if this would be useful to you, though I suppose you could bookmark a link to a sound file or image.
我不知道这对你是否有用,不过我想你可以为一个声音文件或图像添加书签。
#4
What you can do is create an application and under ApplicationDidLoad
in your ApplicationViewController.h
You would type in your code. (If you don't have the SDK, then don't post the question with the tags iPhone-SDK and Cocoa.)
您可以做的是创建一个应用程序,并在ApplicationViewController.h中的ApplicationDidLoad下输入您的代码。 (如果您没有SDK,请不要使用iPhone-SDK和Cocoa标签发布问题。)
#5
In addition to Gene's answer, you may want to set the following meta tags:
除了Gene的答案,您可能还想设置以下元标记:
<link rel="apple-touch-icon" href="https://path/to/icon.png" />
<meta name="apple-mobile-web-app-capable" content="yes" />
#1
You can't do that. The only icon that will appear on the iPhone home screen will be the icon for your application itself.
你不能这样做。 iPhone主屏幕上显示的唯一图标将是应用程序本身的图标。
Edit:
Expanding on the web shortcut idea suggested by Gene, it might be possible you achieve what you want by having a web short cut using a specific protocol handler to open your app with a web short cut added to the home screen. Take a look at this article:
扩展了Gene建议的Web快捷方式,您可以通过使用特定协议处理程序进行Web快捷方式来实现您想要的功能,通过添加到主屏幕的Web快捷方式打开您的应用程序。看看这篇文章:
http://www.mobileorchard.com/apple-approved-iphone-inter-process-communication/
I believe that would still require the user to add the shortcut though, I don't think a third party app can add web shortcuts.
我相信仍然需要用户添加快捷方式,我不认为第三方应用可以添加网页快捷方式。
#2
I found it annoying that google maps cannot be page bookmarked onto the home screen. Here is an almost quick solution:
我发现谷歌地图不能被页面标记到主屏幕上令人讨厌。这是一个几乎快速的解决方案:
-
Create a Tiny URL of the target Google Map. SF Bay Area Traffic is http://maps.google.com/maps?hl=en&ie=UTF8&ll=37.55111,-122.121277&spn=0.810034,1.182404&z=10&layer=t
创建目标Google地图的微小网址。旧金山湾区交通是http://maps.google.com/maps?hl=en&ie=UTF8&ll=37.55111,-122.121277&spn=0.810034,1.182404&z=10&layer=t
-
Mail yourself the Tiny URL.
邮寄自己的小网址。
-
Select the URL in the email application.
在电子邮件应用程序中选择URL。
-
Before Safari realizes that it is a Google Map url, touch the x on the url line to cancel the transfer to the Google Map App.
在Safari意识到它是Google地图网址之前,请触摸网址行上的x以取消转移到Google地图应用。
-
Touch the + at the bottom of Safari and touch "Add to Home Screen"
触摸Safari底部的+,然后触摸“添加到主屏幕”
Name it appropriately and, there you have it, a Google Map entry on your home screen.
为它命名,并在主屏幕上显示Google Map条目。
#3
Andynormancx is correct. The only exception to this rule (that I know of) is a web shortcut -- within Mobile Safari, you can select "add to home screen", and a shortcut to the bookmarked page will appear on Springboard. The icon is a partial screenshot of the web page.
Andynormancx是对的。此规则(我知道)的唯一例外是Web快捷方式 - 在Mobile Safari中,您可以选择“添加到主屏幕”,并且Springboard上将显示已添加书签的页面的快捷方式。该图标是网页的部分屏幕截图。
I don't know if this would be useful to you, though I suppose you could bookmark a link to a sound file or image.
我不知道这对你是否有用,不过我想你可以为一个声音文件或图像添加书签。
#4
What you can do is create an application and under ApplicationDidLoad
in your ApplicationViewController.h
You would type in your code. (If you don't have the SDK, then don't post the question with the tags iPhone-SDK and Cocoa.)
您可以做的是创建一个应用程序,并在ApplicationViewController.h中的ApplicationDidLoad下输入您的代码。 (如果您没有SDK,请不要使用iPhone-SDK和Cocoa标签发布问题。)
#5
In addition to Gene's answer, you may want to set the following meta tags:
除了Gene的答案,您可能还想设置以下元标记:
<link rel="apple-touch-icon" href="https://path/to/icon.png" />
<meta name="apple-mobile-web-app-capable" content="yes" />