Search code examples
iphoneuiviewcontrolleruiimagepickercontroller

viewWillApear not called for UIImagePickerController


I have a class which has UIImagePickerController and extends UIViewController. But viewWillAppear/viewDidAppear are not being called for this class. Why so?

I want viewWillAppear to be there so that when I come back to this view, I can make some change.


Solution

  • By coming back you mean coming back from UIImagePickerController after selecting image/media? If you want to display the image/media you selected from UIImagePickerController in your view, you can make changes in the UIImagePickercontroller delegate method :

    - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
    

    which gets called as soon as you select any image or media from imagePicker. You just need to set the delegate of imagePicker to the the class in which you want to display the images.