我正在使用UIImagePickercontroller
拍照。我在UIScrollview
下有图片。当我从scrollview点击特定图像时,图像将是imageView的子视图。并且imageView将出现在overlayView的叠加层上。当我从上到下或在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];
}