首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Iphone >

(转)iphone应用开发:发送短信/邮件/通电话

2012-09-24 
(转)iphone应用开发:发送短信/邮件/打电话+ (void) makeCall:(NSString *)phoneNumber{if ([DeviceDetecti

(转)iphone应用开发:发送短信/邮件/打电话

+ (void) makeCall:(NSString *)phoneNumber  {      if ([DeviceDetection isIPodTouch]){          [UIUtils alert:kCallNotSupportOnIPod];          return;      }            NSString* numberAfterClear = [UIUtils cleanPhoneNumber:phoneNumber];                NSURL *phoneNumberURL = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@", numberAfterClear]];      NSLog(@"make call, URL=%@", phoneNumberURL);            [[UIApplication sharedApplication] openURL:phoneNumberURL];      }  + (void) sendSms:(NSString *)phoneNumber  {      if ([DeviceDetection isIPodTouch]){          [UIUtils alert:kSmsNotSupportOnIPod];          return;      }            NSString* numberAfterClear = [UIUtils cleanPhoneNumber:phoneNumber];            NSURL *phoneNumberURL = [NSURL URLWithString:[NSString stringWithFormat:@"sms:%@", numberAfterClear]];      NSLog(@"send sms, URL=%@", phoneNumberURL);      [[UIApplication sharedApplication] openURL:phoneNumberURL];      }  + (void) sendEmail:(NSString *)phoneNumber  {      NSURL *phoneNumberURL = [NSURL URLWithString:[NSString stringWithFormat:@"mailto:%@", phoneNumber]];      NSLog(@"send sms, URL=%@", phoneNumberURL);      [[UIApplication sharedApplication] openURL:phoneNumberURL];      }  + (void) sendEmail:(NSString *)to cc:(NSString*)cc subject:(NSString*)subject body:(NSString*)body  {      NSString* str = [NSString stringWithFormat:@"mailto:%@?cc=%@&subject=%@&body=%@",                       to, cc, subject, body];      str = [str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];        }  


原文:http://blog.csdn.net/qiaoshe/article/details/6936643

热点排行