iOS中跳转到邮箱,微信,微博,以及拨打电话

iOS开发中一般在关于我们,或是联系我们的资料页面,会有很多反馈信息,
if (indexPath.row == 1) { // 邮箱

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://love@fitapp.cn"]];

}else if (indexPath.row == 2) {// 电话

    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:DMSG0044 message:nil preferredStyle:UIAlertControllerStyleActionSheet];
    // Create the actions.
    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action){

    }];
    UIAlertAction *otherAction = [UIAlertAction actionWithTitle:@"拨打" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){

        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://021-52936160"]];

    }];
    // Add the actions.
    [alertController addAction:cancelAction];
    [alertController addAction:otherAction];
    alertController.popoverPresentationController.sourceView = tableView;
    CGRect rectInTableView = [tableView rectForRowAtIndexPath:indexPath];
    CGRect rect = [self.view convertRect:rectInTableView toView:tableView];
    alertController.popoverPresentationController.sourceRect = rect;
    [self presentViewController:alertController animated:YES completion:nil];

}else if (indexPath.row == 3) {// 微博

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:weiBoUrl]];

}else if (indexPath.row == 4) {// 微信 公众号

    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:WMSG0011 message:nil preferredStyle:UIAlertControllerStyleAlert];
    // Create the actions.
    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action){

    }];
    UIAlertAction *otherAction = [UIAlertAction actionWithTitle:@"打开" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){

        // 跳转到微信
        NSURL *url = [NSURL URLWithString:@"wechat://"];
        // 如果已经安装了这个应用,就跳转
        if ([[UIApplication sharedApplication] canOpenURL:url]) {
            [[UIApplication sharedApplication] openURL:url];
        }
    }];
    // Add the actions.
    [alertController addAction:cancelAction];
    [alertController addAction:otherAction];
    if (IS_IOS9) {
        alertController.preferredAction = alertController.actions[alertController.actions.count-1];
    }
    [self presentViewController:alertController animated:YES completion:nil];

}else if (indexPath.row == 5) {
    NSURL * link = [NSURL URLWithString:[NSString stringWithFormat:@"%@/service",webUrlString]];
    NSDictionary * dic = @{@"link":link,@"title":@"服务条款"};
    [[CommonMediator shareMediator:self] pushToWebViewController:dic];

}else if (indexPath.row == 6) {
    NSURL * link = [NSURL URLWithString:[NSString stringWithFormat:@"%@/privacy",webUrlString]];
    NSDictionary * dic = @{@"link":link,@"title":@"隐私条款"};
    [[CommonMediator shareMediator:self] pushToWebViewController:dic];
}

}

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值