Search code examples
iphoneioscamerauiimagepickercontroller

iOS Camera Customization: How to implement Grid Lines?


I am able to use the flash feature, access the photo gallery, and use the rear/front camera.

I would like to implement grid lines that display when the user is taking a photo.

Any ideas?


Solution

  • Create a UIImageView to use for the cameraOverlayView.

    Assuming you've got a UIImagePickerController named yourImagePickerController and also that you've got an image file named overlay.png as your 'grid lines'. When making your grid line image file, be sure to use a transparent background - not opaque white.

    UIImageView *overlayImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"overlay.png"]];
    
    CGRect overlayRect = CGRectMake(0, 0, overlayImage.image.size.width, overlayImage.image.size.height);
    
    [overlayImage setFrame:overlayRect];
    
    [yourImagePickerController setCameraOverlayView:overlayImage];