1

我是UIImagePickercontroller用来拍照的。我在UIScrollview. 当我从滚动视图中单击特定图像时,该图像将是 imageView 的子视图。并且imageView会出现在overlay的cameraView上。当我将特定图像从上到下或cameraView上的任何位置移动时,我需要使用叠加层拍照。但我无法用叠加层拍摄照片。

代码:

picker = [[UIImagePickerController alloc] init];


    // Set the image picker source:
    // picker.sourceType = UIImagePickerControllerSourceTypeCamera;

    // Hide the controls:
    picker.showsCameraControls = YES;
    picker.navigationBarHidden = YES;

    picker.delegate=self;

    // Make camera view full screen:
    picker.wantsFullScreenLayout = YES;

    // Insert the overlay:
     picker.cameraOverlayView = self.view;



    self.view.backgroundColor=[UIColor clearColor];

    // Show the picker:
     [self presentModalViewController:picker animated:YES];

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
    UIImageWriteToSavedPhotosAlbum(image,self,
                                   @selector(image:finishedSavingWithError:contextInfo:),
                                   nil);
}

- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
{
    UIAlertView *alert;


    if (error)
        alert = [[UIAlertView alloc] initWithTitle:@"Error"
                                           message:@"Unable to save image to Photo Album."
                                          delegate:self cancelButtonTitle:@"Ok"
                                 otherButtonTitles:nil];
    else
        alert = [[UIAlertView alloc] initWithTitle:@"Success"
                                           message:@"Image saved to Photo Album."
                                          delegate:self cancelButtonTitle:@"Ok"
                                 otherButtonTitles:nil];
    [alert show];
    // [alert release];
}
4

0 回答 0