xcode 如何在我的 iOS 应用程序中链接到网站或 Safari
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10575712/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to Link to a Website or Safari within my iOS app
提问by user1392556
I am using Xcode to develop an iOS app and I need to know how to link a website to a button to open with in the app. I want o have a drop down bar that has buttons to return to a separate screen and a button to save the link to another place. Is there a way to open a website or a link to safari with my app?
我正在使用 Xcode 开发一个 iOS 应用程序,我需要知道如何将网站链接到一个按钮以在应用程序中打开。我想要一个下拉栏,它有返回到单独屏幕的按钮和一个将链接保存到另一个地方的按钮。有没有办法用我的应用程序打开一个网站或一个 safari 的链接?
回答by Phillip Mills
You can open a website directly by using a UIWebView object in your app.
您可以通过在应用中使用 UIWebView 对象直接打开网站。
You can get Safari to open a web site by invoking something like [[UIApplication sharedApplication] openURL:myURL]
.
您可以通过调用类似[[UIApplication sharedApplication] openURL:myURL]
.