zoukankan      html  css  js  c++  java
  • 转ihone程序内发邮件,发短信,打开链接等

    来自于http://tr4work.blog.163.com/blog/static/13714931420104131511931/ 

    1、从程序内 发送短信

    [[UIApplication sharedApplicationopenURL:[NSURL URLWithString:@"sms:// "]];
    短信的内容无法初始化,至少在3.2之前是这样,但是可以通过将要初始化的信息写到拷贝里来弥补。
    2、从程序内 发送邮件
    -(void) checkSender:(id) sender{

    Class mailClass = (NSClassFromString(@"MFMailComposeViewController"));

    if (mailClass != nil) {

    if ([mailClass canSendMail]){

    [self displayComposerSheet];

    }else{

    [self launchMailAppOnDevice];

    }

    else{

    [self launchMailAppOnDevice];

    }

    }


    #pragma mark -

    #pragma mark Compose Mail


    // Displays an email composition interface inside the application. Populates all the Mail fields. 

    -(void)displayComposerSheet 

    {

    MFMailComposeViewController *picker = [[MFMailComposeViewController allocinit];

    picker.mailComposeDelegate = self;

    [picker setSubject:@"subject"];

    // Fill out the email body text

    NSString *emailBody = @"email body";

    [picker setMessageBody:emailBody isHTML:NO];

    [self presentModalViewController:picker animated:YES];

        [picker release];

    }


    - (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error 

    {

    [self dismissModalViewControllerAnimated:YES];

    }


    3、从程序里 打开safari

    [[UIApplication sharedApplicationopenURL:[NSURL URLWithString:@"http://tr4work.blog.163.com/"]];


    4、从程序里 打开电话功能
    [[UIApplication sharedApplicationopenURL:[NSURL URLWithString:@"tel://1000000"]];
    5、制作一个黏贴,拷贝
    UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];

    pasteboard.string =@"初始化信息";

  • 相关阅读:
    远程桌面无法复制粘贴
    软件无法启动,不提示具体错误
    从数据库统计出某张表中某个字段重复次数
    程序员何去何从
    SQL Server中TRUNCATE 和 DELETE的区别
    关于C#自定义控件注释说明
    C#的winform程序下如何实现文本编辑框(TextBox)的Hint提示文字效果
    ubuntu固定内网ip地址
    数据库的优化处理 Memory cached
    MYSQL管理之主从同步管理
  • 原文地址:https://www.cnblogs.com/luyinghuai/p/1964171.html
Copyright © 2011-2022 走看看