iOS_常用的小功能
来源:互联网 发布:蜂窝移动网络搜索 导航 编辑:程序博客网 时间:2024/06/06 04:21
- 打电话
NSString *telNumberStr = @"020-12345678";// 方式一:在iOS10.1版本不会弹框提示,直接拨打电话。NSString *telString = [[NSString alloc] initWithFormat:@"tel:%@",telNumberStr];// 方式二:会弹框提示。NSString *telString = [[NSString alloc] initWithFormat:@"telprompt://%@",telNumberStr];[[UIApplication sharedApplication] openURL:[NSURL URLWithString:telString]];
- 发短信方式一:
NSString *url = @"sms://10086";[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
- 发短信方式二:
1、导入框架:#import <MessageUI/MessageUI.h>2、遵循协议:<MFMessageComposeViewControllerDelegate>3、代码调用实现:MFMessageComposeViewController *msgVC =[[MFMessageComposeViewController alloc] init];// 设置短信内容msgVC.body = @"一起玩耍吧";// 设置收件人列表msgVC.recipients = @[@"10086", @"10010"];// 设置代理msgVC.messageComposeDelegate = self;// 显示控制器(self指代ViewController)[self presentViewController:msgVC animated:YES completion:nil];4、代理回调#pragma mark - MFMessageComposeViewControllerDelegate// 短信界面关闭后回调,会自动回到应用的页面- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result{ // 关闭短信页面 [controller dismissViewControllerAnimated:YES completion:nil]; // 返回短信结果 if (result == MessageComposeResultCancelled) { NSLog(@"点击右上角、取消按钮"); } if (result == MessageComposeResultSent) { NSLog(@"短信发送"); } if (result == MessageComposeResultFailed) { NSLog(@"发送失败"); }}
- 利用
Safari
打开链接
NSString *url = @"http://www.baidu.com";[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
- 跳转至设置页面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
- 跳转至
AppStore
详情页
NSString *appId = @"";NSString *url = [NSString stringWithFormat:@"https://itunes.apple.com/us/app/id%@",appId];[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
- 跳转至
AppStore
评论页
NSString *appId = @"";NSString *url = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?onlyLatestVersion=true&pageNumber=0&sortOrdering=1&type=Purple+Software&id=%@",appId];[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
阅读全文
0 0
- iOS_常用的小功能
- iOS_一些小功能
- 一些常用的小功能
- js的常用小功能
- 常用的ps小功能
- 常用的js小功能
- 常用的TextView小功能
- php常用的小功能
- 注册表的一些常用小功能
- Linux的几个常用小功能
- 记录常用的一些小功能代码
- iOS常用小功能的实现
- js 常用小功能
- js 常用小功能
- Android常用小功能
- js 常用小功能
- iOS 常用小功能
- iOS常用小功能
- 树,UVA 548
- python3.6基础学习记录(一)
- Java集合
- Redis 集群端口
- 1076. Forwards on Weibo (30)
- iOS_常用的小功能
- Vijos / 题库 / SuperBrother打鼹鼠 1512
- mysql5.7.19用户的创建和权限的操作
- java做空心菱形
- codeforces 832D Misha, Grisha and Underground 倍增lca
- HNUSTOJ 1587: 土豪金的加密与解密
- Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant)
- hdu1711--kmp入门题
- 找到linux中当前java的安装位置