简体   繁体   中英

Using The UIImagePickerController to select and upload a photo to server.

I am using the Picker controller with UIImagePickerControllerSourceTypePhotoLibrary .

In the delegate didFinishPickingImage is called, but when I click on the cancel button it doesn't enter:

(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker 

This happens even though the controller is dismissed.

Make sure the class you think it is calling implements the proper delegate protocol.

This case should be UIImagePickerControllerDelegate, like this:

@interface YourClassViewController : UIViewController < UIImagePickerControllerDelegate>

You need to implement the rest of UIImagePickerControllerDelegate. When the cancel button is clicked, the picker will call -imagePickerControllerDidCancel: on its delegate.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM