程序之间的跳转 iOS开发

程序之间的跳转:


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://"]];

}










  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值