程序之间的跳转:
AppDelegate中:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
self.mainVC = [[MainViewController alloc] init];
UINavigationController *navi = [[UINavigationController alloc] initWithRootViewController:_mainVC];
self.window.rootViewController = navi;
return YES;
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
self.mainVC.myL.text = @"lalal";
self.mainVC.myL.text = [[url host] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
return YES;
}
@interface MainViewController ()
@end
@implementation MainViewController
/*
Safari: http://
maps: http://maps.google.com
Phone: tel:
SMS: sms:
Mail: mailto:
iBooks: ibooks://
App Store: http://itunes.apple.com
iTunes: http:http://phobos.apple.com
Music / iPod: music:
Videos: videos:
常用第三方软件:
名称 URL Scheme Bundle identifier
QQ: mqq://
微信: weixin://
腾讯微博: TencentWeibo://
淘宝: taobao://
支付宝: alipay://
微博: sinaweibo://
weico微博: weico://
QQ浏览器: mqqbrowser:// com.tencent.mttlite
uc浏览器: ucbrowser:// com.ucweb.iphone.uc
com.ucweb.iphone.lowversion
海豚浏览器: dolphin:// com.dolphin.browser.iphone.chinese
欧朋浏览器: ohttp://(后要接地址,不然出错) com.oupeng.mini
搜狗浏览器: SogouMSE:// com.sogou.SogouExplorerMobile
百度地图: baidumap://
bdmap:// com.baidu.map
百度地图: bdmap:// com.baidu.map
Chrome: googlechrome://
优酷: youku://
京东: openapp.jdmoble://
人人: renren://
美团: imeituan://
1号店: wccbyihaodian://
我查查: wcc://
有道词典: yddictproapp://
知乎: zhihu://
点评: dianping://
dianping://search
微盘: sinavdisk://
豆瓣fm: doubanradio://
网易公开课: ntesopen://
名片全能王: camcard://
淘宝宝贝搜索 taobao://http://s.taobao.com/?q=[prompt]
淘宝店铺搜索 taobao://http://shopsearch.taobao.com/browse/shop_search.htm?q=[prompt]
*/
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
UIButton *btnWX = [UIButton buttonWithType:UIButtonTypeSystem];
btnWX.frame = CGRectMake(10, 100, self.view.bounds.size.width - 20, 50);
[btnWX setTitle:@"weixin" forState:UIControlStateNormal];
btnWX.backgroundColor = [UIColor yellowColor];
[btnWX addTarget:self action:@selector(WXAction:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btnWX];
UIButton *btnTwo = [UIButton buttonWithType:UIButtonTypeSystem];
btnTwo.frame = CGRectMake(10, 200, self.view.bounds.size.width - 20, 50);
[btnTwo setTitle:@"button" forState:UIControlStateNormal];
btnTwo.backgroundColor = [UIColor yellowColor];
[btnTwo addTarget:self action:@selector(twoAction:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btnTwo];
self.myL = [[UILabel alloc] initWithFrame:CGRectMake(10, self.view.bounds.size.height - 100, self.view.bounds.size.width - 20, 50)];
_myL.textColor = [UIColor blueColor];
_myL.textAlignment = NSTextAlignmentCenter;
_myL.backgroundColor = [UIColor cyanColor];
[self.view addSubview:_myL];
}
- (void)twoAction:(UIButton *)btn
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"jilei://"]];
}
- (void)WXAction:(UIButton *)btn
{
// [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"weixin://"]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"weixin://"]];
}