iOS 打电话,发短信,打开网址
来源:互联网 发布:linux系统发展史 编辑:程序博客网 时间:2024/06/05 20:50
1、调用 自带mail
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://admin@hzlzh.com"]];
2、调用 电话phone
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://8008808888"]];
3、调用 SMS
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms://800888"]];
4、调用自带 浏览器 safari
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.hzlzh.com"]];
调用phone可以传递号码,调用SMS 只能设定号码,不能初始化SMS内容。
若需要传递内容可以做如下操作:
加入:MessageUI.framework
#import <MessageUI/MFMessageComposeViewController.h>
实现代理:MFMessageComposeViewControllerDelegate
调用sendSMS函数
//内容,收件人列表
- (void)sendSMS:(NSString *)bodyOfMessage recipientList:(NSArray *)recipients
{
MFMessageComposeViewController *controller = [[[MFMessageComposeViewControlleralloc] init]autorelease];
if([MFMessageComposeViewControllercanSendText])
{
controller.body = bodyOfMessage;
controller.recipients = recipients;
controller.messageComposeDelegate =self;
[selfpresentModalViewController:controller animated:YES];
}
}
// 处理发送完的响应结果
- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result
{
[self dismissModalViewControllerAnimated:YES];
if (result == MessageComposeResultCancelled)
NSLog(@"Message cancelled")
else if (result == MessageComposeResultSent)
NSLog(@"Message sent")
else
NSLog(@"Message failed")
}
发送邮件的为:
导入#import <MessageUI/MFMailComposeViewController.h>
实现代理:MFMailComposeViewControllerDelegate
//发送邮件
-(void)sendMail:(NSString *)subject content:(NSString *)content{
MFMailComposeViewController *controller = [[[MFMailComposeViewControlleralloc] init]autorelease];
if([MFMailComposeViewControllercanSendMail])
{
[controller setSubject:subject];
[controller setMessageBody:content isHTML:NO];
controller.mailComposeDelegate = self;
[selfpresentModalViewController:controller animated:YES];
}
}
//邮件完成处理
-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error{
[selfdismissModalViewControllerAnimated:YES];
if (result ==MessageComposeResultCancelled)
NSLog(@"Message cancelled");
elseif (result == MessageComposeResultSent)
NSLog(@"Message sent");
else
NSLog(@"Message failed");
}
- iOS 打电话,发短信,打开网址
- iOS--调用打电话,发短信,打开网址
- ios开发打电话,发短信,打开网址
- Ios打电话,调用打电话,发短信,打开网址
- IOS 开发,调用打电话,发短信,打开网址
- IOS 开发,调用打电话,发短信,打开网址
- IOS 开发,调用打电话,发短信,打开网址
- IOS 开发,调用打电话,发短信,打开网址
- IOS 开发,调用打电话,发短信,打开网址
- IOS 开发,调用打电话,发短信,打开网址
- IOS 开发,调用打电话,发短信,打开网址
- IOS 开发,调用打电话,发短信,打开网址
- IOS 开发,调用打电话,发短信,打开网址
- IOS 开发,调用打电话,发短信,打开网址
- IOS 开发,调用打电话,发短信,打开网址
- IOS 开发,调用打电话,发短信,打开网址
- IOS 开发,调用打电话,发短信,打开网址
- IOS 开发,调用打电话,发短信,打开网址
- 一个user space通用Makefile详解
- C++中char*与string的关系
- [Oracle] 常见的等待事件
- 设计模式学习--工厂模式(Factory Pattern)
- iOS开发资源推荐:iOS-NBUKit、GPUImage以及KxMovie等
- iOS 打电话,发短信,打开网址
- java 泛型浅析
- 领先政府网站应该怎样建设?
- SQL联合语句的视觉解释
- 分页时高效的总页数计算
- java----String类
- PS 如何制作 圆角矩形 图片
- 如何取得Win7文件的管理员权限
- GDB详解