#pragma mark - feedback
- (void)sendFeedBackMail{
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"subjbect"];
picker.navigationBar.tintColor = [UIColor colorWithRed:kScreenR/255.0
green:kScreenG/255.0
blue:kScreenB/255.0
alpha:0.5];
NSArray *toRecipients = [NSArray arrayWithObject:@"xx@xx.com"];
[picker setToRecipients:toRecipients];
NSString *emailBody = [NSString
stringWithFormat:@"SystemVersion: %@ \n AppVersion: %@ \n 反馈信息:\n", [[UIDevice currentDevice] systemVersion],
[[[NSBundle mainBundle] infoDictionary]
objectForKey:@"CFBundleShortVersionString"]];
[picker setMessageBody:emailBody isHTML:NO];
[self presentModalViewController:picker animated:NO];
}
#pragma mark - MFMailComposeViewControllerDelegate
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error{
NSString *title = @"邮件发送提醒";
NSString *msg;
switch (result){
case MFMailComposeResultCancelled:
msg = @"邮件已被取消";
break;
case MFMailComposeResultSaved:
msg = @"邮件保存成功";
[self alertWithTitle:title msg:msg];
break;
case MFMailComposeResultSent:
msg = @"邮件发送成功";
[self alertWithTitle:title msg:msg];
break;
case MFMailComposeResultFailed:
msg =@"邮件发送失败";
[self alertWithTitle:title msg:msg];
break;
}
[self dismissModalViewControllerAnimated:YES];
}
- (void) alertWithTitle: (NSString *)_title_ msg: (NSString *)msg{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:_title_
message:msg
delegate:nil
cancelButtonTitle:@"好"
otherButtonTitles:nil];
[alert show];
}