I am making a camera app, which gives the user access to the Photo Library. They touch the button, and UIImagePickerControllerSourceTypeSavedPhotosAlbum pops up using presentModalViewController. When they touch a photo, I want a view to push the ImagePicker to the left and the new view to come in. The thing is, I want to keep the ImagePicker up, so when they go back to it there isn't a lag. This happens in many camera apps like NightCamera. Whenever I use [self.navigationController pushViewController:photoPreview];
, it pushes the view to the main view, not the picker. When I use [picker.navigationController pushViewController:photoPreview];
, nothing happens, because the picker's navigationController is nil. Does anyone know what to do?
Asked
Active
Viewed 3,166 times
2

iSkythe
- 91
- 1
- 9
2 Answers
15
Yes it is possible. There is no such thing as "modal view controller", any view controller can be presented modaly.
Since UIImagePickerController
is already a UINavigationController
, you can push views directly on it. So instead of
[picker.navigationController pushViewController:some_view_controller];
just do
[picker pushViewController:some_view_controller];
removing .navigationController
.
-3
Try this:
if (!picker.navigationController)
UINavigationController *navC = [[[UINavigationController alloc] initWithRootViewController:picker] autorelease];
[picker pushViewController:photoPreview];

Juan de la Torre
- 1,297
- 9
- 19
-
Not really sure what the first two lines are supposed to do. You're simply creating an local variable called navC that's not used anywhere. You should get an "unused variable" compiler warning. No harm in adding those lines, but they don't do a thing. – George Mar 06 '13 at 22:49