简体   繁体   中英

Open a URL from iPhone Application

I want to integrate some links on my iPhone application.

That is when the user touches on the button saying "Yahoo" then Yahoo's page will be opened and then all the functionalities of Yahoo mail has proceeds. How can I do that? I have a bit of idea about NSURL, but not much. Please help me for that. Thanks in advance..

To open the page in Mobile Safari, you need to implement something like the following:

NSURL *url = [NSUR URLWithString:@"http://www.google.com"];
[[UIApplication sharedApplication] openURL:url];

You could return to your application using Custom URL Schemes (for more information see the iPhone Application Programming Guide ), but since you want to access sites over which you have no control, I presume that isn't an option? Could you use a UIWebView control within your app instead?

在目标的操作方法中输入以下内容:

 [[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"http://www.google.com"]];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM