iPhone: Camera Preview Overlay

后端 未结 4 1149
借酒劲吻你
借酒劲吻你 2020-12-12 11:03

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 UIImagePickerCon

4条回答
  •  北荒
    北荒 (楼主)
    2020-12-12 11:59

    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.

提交回复
热议问题