读书人

在一个应用程序中其余的应用比如说网

发布时间: 2012-06-28 15:20:04 作者: rapoo

在一个应用程序中其他的应用,比如说网站,App Store等等

在一个应用程序中启动其他的服务是用方法: UIApplication:openURL

这里罗列了七种服务可以被启动:

1, Browse

2, Google Maps

3, Apple Mail

4, Phone Call

5, SMS Application

6, App Store

?

1, Browse

?

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

2, Google Maps

格式:http://maps.google.com/maps?q=${QUERY_STRING}

// Create your query ...NSString* searchQuery = @"1 Infinite Loop, Cupertino, CA 95014";?// Be careful to always URL encode things like spaces and other symbols that aren't URL friendlysearchQuery =  [addressText stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];?// Now create the URL string ...NSString* urlString = [NSString stringWithFormat:@"http://maps.google.com/maps?q=%@", searchQuery];?// An the final magic ... openURL![[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlText]];

3, Apple Mail

格式:mailto://${EMAIL_ADDRESS}

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://info@iphonedevelopertips.com"]];

4, Phone Call(只是对iPhone)

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://8004664411"]];

5, SMS Application

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms:55555"]];

6, App Store

?

读书人网 >移动开发

热点推荐