我现在无法在iPhone上测试我的应用,所以我需要一些帮助。 我作家简单的相机应用程序我需要,当用户制作快照时 - 这张照片会转到我的应用程序。我使用默认的相机界面。
- (IBAction)cameraButtonAction:(id)sender {
self.newPhoto = YES;
[self continueWithSourceType:UIImagePickerControllerSourceTypeCamera];
}
- (void)continueWithSourceType: (UIImagePickerControllerSourceType)sourceType
{
UIImagePickerController * imagePickerController = [[UIImagePickerController alloc]init];
imagePickerController.delegate = self;
imagePickerController.sourceType = sourceType;
imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
imagePickerController.mediaTypes = @[(NSString *) kUTTypeImage];
if ([imagePickerController.mediaTypes isEqual: @[(NSString *) kUTTypeMovie]])
{
}
if (sourceType == UIImagePickerControllerSourceTypeCamera)
{
imagePickerController.showsCameraControls = YES;
}
//cam
self.imagePickerController = imagePickerController;
[self presentViewController:imagePickerController animated:YES completion:nil];
}
所以我需要将用户快照保存在self.image中:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage * image = [info objectForKey:UIImagePickerControllerOriginalImage];
if (self.newPhoto)
{
UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:finishedSavingWithError:contextInfo:), nil);
}
//cam
self.image = image;
[self dismissViewControllerAnimated:NO completion:nil];
}
但如果用户会制作2张或3张照片?以及他如何回到我的应用程序?