oc拨打电话
2016-04-14 15:48
253 查看
判断当前设备是否支持电话功能
+(int)isCanCall{
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad || [[[UIDevice currentDevice] model] isEqualToString:@"iPod touch"]){
return 0;
}
#if TARGET_IPHONE_SIMULATOR//模拟器
return 0;
#elif TARGET_OS_IPHONE//真机
return 1;
#endif
}
1,这种方法,拨打完电话回不到原来的应用,会停留在通讯录里,而且是直接拨打,不弹出提示
NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"tel:%@",@"186xxxx6979"];
// NSLog(@"str======%@",str);
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
2,这种方法,打完电话后还会回到原来的程序,也会弹出提示,推荐这种
NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"tel:%@",@"186xxxx6979"];
UIWebView * callWebview = [[UIWebView alloc] init];
[callWebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:str]]];
[self.view addSubview:callWebview];
[callWebview release];
[str release];
3,这种方法也会回去到原来的程序里(注意这里的telprompt),也会弹出提示
NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"telprompt://%@",@"186xxxx6979"];
// NSLog(@"str======%@",str);
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]]
+(int)isCanCall{
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad || [[[UIDevice currentDevice] model] isEqualToString:@"iPod touch"]){
return 0;
}
#if TARGET_IPHONE_SIMULATOR//模拟器
return 0;
#elif TARGET_OS_IPHONE//真机
return 1;
#endif
}
1,这种方法,拨打完电话回不到原来的应用,会停留在通讯录里,而且是直接拨打,不弹出提示
NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"tel:%@",@"186xxxx6979"];
// NSLog(@"str======%@",str);
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
2,这种方法,打完电话后还会回到原来的程序,也会弹出提示,推荐这种
NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"tel:%@",@"186xxxx6979"];
UIWebView * callWebview = [[UIWebView alloc] init];
[callWebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:str]]];
[self.view addSubview:callWebview];
[callWebview release];
[str release];
3,这种方法也会回去到原来的程序里(注意这里的telprompt),也会弹出提示
NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"telprompt://%@",@"186xxxx6979"];
// NSLog(@"str======%@",str);
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]]
相关文章推荐
- SASS常用语法
- R 控制坐标画图参数
- Block初探
- C语言结构体大小
- JS实现图片推拉门效果
- 多态和虚函数
- Win7远程控制fedora ——通过xrdp
- 线程中断 thread.interrupt()的用法
- 对四大浏览器内核的了解
- 如何优雅进行 cocos2dx + lua 开发
- Android 修改EditText的光标颜色和背景色
- mangoBD地理位置索引JAVA实战
- java异常处理,目前还是不懂,问题先留在这里,以后再解决
- hibernate自动建表采用UTF-8字符编码
- Mac 下查看 Android Studio 的 SHA1的方法
- Java类名.class和getClass()区别
- UVA-129 Krypton Factor(dfs)
- JSP中常用的JSTL fmt(format格式化)标签用法整理
- 面试题
- 类与对象(3)继承,重载,覆盖