在应用程序本身拍照后,我想通过电子邮件发送此照片(附上)UIActivityView
。
以下是我正在使用的代码。它在项目中拍摄了一张照片,但我需要获取(发送)我刚开发的应用程序所拍摄的照片。
(IBAction)shareImage:(id)sender
{
UIImage *image = [***UIImage imageNamed:@"zzzzz.png"***];
NSString *message = @"yyyyyyy";
NSArray *postItens = @[image, message];
UIActivityViewController *objVC = [[UIActivityViewController alloc]
initWithActivityItems:postItens applicationActivities:nil];
[self presentViewController:objVC animated:YES completion:nil];
}
这是我选择图片的代码:
(void) useCamera{if ([UIImagePickerController isSourceTypeAvailable:
UIImagePickerControllerSourceTypeCamera])
{
UIImagePickerController *imagePicker =[[UIImagePickerController alloc] init];
imagePicker.delegate = self;imagePicker.sourceType =UIImagePickerControllerSourceTypeCamera;
imagePicker.mediaTypes = [NSArray arrayWithObjects:(NSString *) kUTTypeImage,nil];
imagePicker.allowsEditing = YES;
[self presentModalViewController:imagePicker
animated:YES];
newMedia = YES;
}
-(void)imagePickerController:(UIImagePickerController *) pickerdidFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSString *mediaType = [infoobjectForKey:UIImagePickerControllerMediaType];
[self dismissModalViewControllerAnimated:YES];
if ([mediaType isEqualToString:(NSString *)kUTTypeImage])
{
UIImage *image = [infoobjectForKey:UIImagePickerControllerOriginalImage];
imageView.image = image;
if(newMedia)UIImageWriteToSavedPhotosAlbum(image,self,@selector(image:finishedSavingWithError:contextInfo:),nil);}else if ([mediaType isEqualToString:(NSString *)kUTTypeMovie]){// Code here to support video if enabled}}