Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Alex Puray
Alex Puray
1,304 Points

ViewDidAppear with UIImagePickerController.

Is there a way to do a ViewDidAppear with UIImagePickerController when switching to another view? all I get is the camera reloading after I press the "use" button. Help would be much appreciated! Thank you.

2 Answers

Not sure what you mean, you want viewWillAppear to get called when a presented UIImagePikerController has a button pressed?

Ben Jakuben
Ben Jakuben
Treehouse Teacher

If I understand correctly, tapping Use causes the UIImagePickerController to disappear, but then it appears again because you are presenting it in viewWillAppear? If you proceed with the course, you will find that we wrap the call to present the UIImagePickerController in an if statement that prevents it from showing again:

if (self.image == nil && [self.videoFilePath length] == 0) {

Have you implemented any code in imagePickerController:didFinishPickingMediaWithInfo:? That gets called when you tap Use. You can set a property or something in that method that you can check in the viewWillAppear or viewDidAppear methods.

Hope this helps!