Dobler
Dobler

Reputation: 829

Custom UIImagePicker removes navigationBar when pushing custom view

In my project I need to attach another uiviewcontroller to the end of the imagepicker chain.

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)editInfo 
{
uploadPhotoViewController * newView = [[uploadPhotoViewController alloc] initWithNibName:@"uploadPhotoViewController" bundle:nil];
    newView.contest = received;
    newView.receivedImage = img;
    newView.parentImagePicker = picker; // this doesn't help
    [picker pushViewController:newView animated:YES];

}

This works great, but when I use the camera as the source it clears the navigation bar and I can not get it to become visible. I have tried the usual:

-(void)viewWillAppear:(BOOL)animated 
{
    [super viewWillAppear:animated];
    self.wantsFullScreenLayout = FALSE;
    self.navigatioController.navigationBar.hidden = false;
    self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
    [[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO];
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:YES];
}

The status bar will come back in the pushed view, but the navigation bar is another beast. I am guessing that since this is a modal that the navigationcontroller is being sent to the view stack underneath. Does anyone know how to address the image picker? I tried passing the image picker in as an object for the view controller as you can see in the first codeblock and then I tried addressing it like this:

    self.parentImagePicker.navigationBar.hidden = false;
    self.parentImagePicker.navigationBar.barStyle = UIBarStyleBlackTranslucent

But that didn't help either. So I'm stumped. Is their some ivar or something that will allow me to address the picker?

Upvotes: 2

Views: 1117

Answers (1)

Dobler
Dobler

Reputation: 829

Oh cool, I figured it out. while the call

self.navigatioController.navigationBar.hidden = false;

does not work,

[self.navigationController setNavigationBarHidden:NO];

this one does.

Upvotes: 4

Related Questions