iPhone: Camera Preview Overlay

Viewed 28640

How do I add an overlay (UIImageView) to the camera preview and handle touches on this?

My previous attempts to do this (e.g. use UIImagePickerController and add the image as a subview) have failed.

3 Answers

You may be able to add the UIImageView as a subview of the main window directly instead of the UIImagePicker, it may work better. Just make sure to add them in the right order, or call

[window bringSubviewToFront:imageView];

after the camera is up.

If you want to handle touches on the UIImageView you could just add the UIImageView as a subview of a normal fullscreen View with a transparent background, and add that to the window instead, with a normal UIViewController subclass that you can use to handle the touch events.

See the camera overlay view (available in 3.1 and later)

@property(nonatomic, retain) UIView *cameraOverlayView
Related