I have been updating an app that I had some else build for me. In the updating, I am instituting storyboard segues, among other things, and have got the app almost complete. One little niggling issue is when I take an picture with the camera and the image is presented in the TakenImageView, the NavBar is not visible. Yet, if I go from the gallery to the TakenImageView, the NavBar shows! Ugh. The image picker is presented from the HomeView, then moves to TakenImage after the user chooses camera or gallery. I have tried to change to a prepare and perform Segue, but the segue doesn't fire from the gallery when selecting an image or from the camera's UsePhoto. The only way I can get the image to the TakenImageView is to manually segue via instantiating the view in code. See below...
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info;
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
TakenImageVC *takenVC = [storyboard instantiateViewControllerWithIdentifier:@"TakenImageVC"];
takenVC.takenimage = [info objectForKey:UIImagePickerControllerOriginalImage];
[picker pushViewController:takenVC animated:YES];
//_pickerImage = [info objectForKey:UIImagePickerControllerOriginalImage];
//[self performSegueWithIdentifier:@"TakenSegue" sender:self];
}
The prepare for segue has only these three. The top two are modal and are linking from the buttons. The TakenSegue is linking from the controller. Of course, I have the destinationController commented out, as the segue doesn't fire when using perform as noted earlier.
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"InfoSegue"])
{
NSLog(@"Info Modal view");
}
if ([segue.identifier isEqualToString:@"HelpSegue"])
{
NSLog(@"Help Modal view");
}
if ([segue.identifier isEqualToString:@"TakenSegue"])
{
NSLog(@"Taken Segue");
//TakenImageVC *takenVC = segue.destinationViewController;
//takenVC.takenimage = _pickerImage;
}
}
In trying different methods, I have added a NavigationController between the HomeView and TakenImageView and have changed the class to UIImagePickerController in the attributes. Still, the NavBar doesn't show... but only after taking a photo with the camera! And, yes, I have the navigation bar set to not hide... in both the HomeView and TakenView. This is in the viewWillAppear of both controllers.
Target is iOS7.1 and up. Running Xcode 7.
I'd appreciate some help from anyone with a hint as to what is causing the nav bar to not show from the camera and, of course, a way to fix it! Thanks!
I was unable to get the next view to show with a nav bar after the camera, even after trying numerous scenarios. So, after seeing a hint in a different post, I removed the nav controller between the home and taken view, changed the attributes to none for Simulated Metrics/Top Bar and inserted a toolbar in it's place in the TakenView and two following views. Yes, it required more work in Storyboard and I had to add a label where the title should go, but it is all functioning. And, I didn't have to add any more code, except for changing the back or cancel buttons into unwindSegues.