imated:YES completion:^{
}];
}
#pragma mark--------------使用相机----------------
// 选中照片
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
NSLog(@"%@", info);
UIImageView *imageView = (UIImageView *)[self.view viewWithTag:101];
// UIImagePickerControllerOriginalImage 原始图片
// UIImagePickerControllerEditedImage 编辑后图片
UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
imageView.image = image;
[picker dismissViewControllerAnimated:YES completion:NULL];
}
// 取消相册
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
[picker dismissViewControllerAnimated:YES completion:NULL];
}
#pragma mark--------------发送短信----------------
-(void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result
{
NSString *title = @"邮件发送提醒";
NSString *msg;
switch (result) {
case MessageComposeResultCancelled:
msg = @"短信取消!";
[self alertWithTitle:title msg:msg];
break;
case MessageComposeResultSent:
msg = @"短信成功发送!";
[self alertWithTitle:title msg:msg];
break;
case MessageComposeResultFailed:
msg = @"短信发送失败!";
[self alertWithTitle:title msg:msg];
break;
}
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark--------------发送邮件----------------
-(void)sendFeedBackMail
{
//是否创建邮件
BOOL judge = [MFMailComposeViewController canSendMail];
if (judge) {
//创建邮件
MFMailComposeViewController *pick = [[MFMailComposeViewController alloc]init];
//标题
[pick setSubject:@"意见反馈"];
//邮件地址
NSArray *address = [NSArray arrayWithObject:@"请填上自己的邮箱"];
[pick setToRecipients:address];
//内容
NSString *message = @"你好!";
pick.mailComposeDelegate = self;
[pick setMessageBody:message isHTML:NO];
//返回
[self presentViewController:pick animated:YES completion:NULL];
}
}
//代理
-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
NSString *title = @"邮件发送提醒";
NSString *msg;
switch (result) {
case MFMailComposeResultCancelled:
msg = @"邮件取消!";
[self alertWithTitle:title msg: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 dismissViewControllerAnimated:YES completion:NULL];
}
- (void)alertWithTitle:(NSString *)_title_ msg:(NSString *)msg{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:_title_
message:msg
delegate:nil
cancelButtonTitle:@"好"
otherButtonTitles:nil];
[alert show];
}
|