UIImagePickerController: Detecting Camera button (shutter) pressed

情到浓时终转凉″ 提交于 2019-11-29 12:37:27
Axel

To learn about camera button press event, you can fire a NSNotification for it.

// Add observer for when camera button is pressed
NSNotificationCenter.defaultCenter().addObserver(self, selector: @selector(yourFunctionToPerform), name: "_UIImagePickerControllerUserDidCaptureItem", object: nil)

Also add the following method to the ViewController where you are creating ImagePickerViewController:

-(void) yourFunctionToPerform{

    //Do what you want to do on Camera button tap event

}

I was searching for this problem too, the key/name for the event is really obscure.

You CAN display it AFTER they choose the image.

- (void)imagePickerController:(UIImagePickerController *)picker 
        didFinishPickingImage:(UIImage *)image
                  editingInfo:(NSDictionary *)editingInfo
{
        //Display the UIAlertView
    [alertView show];
        //Just never use the image
}

If you don't want to use the image you really don't have to

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!