As the title says, I need to create a very simple camera overlay while taking photos with UIImagePickerController. I want to add very simple .png file (like an empty box) over the camera but I can’t figure out how to do it.
I’ve checked most of the tutorials in this webpage but don’t understand most of them. It seems very hard to me and adding one simple .png file to the camera overlay should be easier than that.
(IBAction) getPhoto:(id) sender {
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
if((UIButton *) sender == choosePhotoBtn) {
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
} else {
}
label1.text =@"PHOTO ACTION";
[self presentModalViewController:picker animated:YES];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissModalViewControllerAnimated:YES];
imageView.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
}
Where should I implement my overlay code? What classes should I use and how can I do it?
There is a property of
UIImagePickerControllercalledcameraOverlayView. It’s anUIView*, so you need to create one and put your PNG to the background of it, then assign it to this property of yourpicker.Ok, here’s the code (i didnt test it so)
Of course, you can use some custom
UIView*subclass instead of creating standardUIView* overlayView, but everything else will remain the same.