1、从程序内 发送短信
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 alloc] init];
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 sharedApplication] openURL:[NSURL URLWithString:@"http://tr4work.blog.163.com/"]];
pasteboard.string =@"初始化信息";