Reputation: 6119
My app basically has two view controllers, starting in a navigation controller:
1) MainViewController, which asks user to pick Camera or Album and then presents UIImagePicker
2) PhotoViewController, which receives photo.
However, in the second VC, when the user hits "Back", I would prefer to immediately return to either the Camera or Album they selected, rather than MainVC and then reloading the picker.
Should I separate an entirely new ViewController dedicated to the ImagePicker rather than presenting it within MainViewController? Using pushViewController:
doesn't work as 'Pushing a navigation controller is not supported'
perhaps meaning that imagePickers are nav controllers too.
MainViewController currently displays it like this:
[self.navigationController presentViewController:self.imagePicker animated:YES completion:nil];
Any suggestions appreciated, thanks.
Upvotes: 1
Views: 1064
Reputation: 1346
A simple solution could be inside your MainVC have 2 bool values calledCamera, calledLibrary when you create your new VC you set the one you choose your pic from to YES. So when you come back...
- (void) viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
if (calledCamera){
//call cameraPicker to load before de MainVc shows
}
if (calledLibrary){
//call the LibraryPicker before...
}
}
Upvotes: 1