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];
}
}