views:

760

answers:

3

I've put a table on the flipside of my Utility Application template. The template automatically puts a titlebar with a done button to go back to the front view.

When one of the cells in the flipside's table is selected, it brings up the Camera / Image Library picker. But it leaves the titlebar is position, partially obscuring the picker interface.

How do I remove the titlebar while the picker is in effect? thanks

+2  A: 
  1. Add an outlet to FlipsideViewController.h for the UINavigationBar.
  2. Open the FlipsideView.xib and connect the outlet.
  3. When showing the image picker, set the hidden property of the UINavigationBar to true.
  4. When the image picker is dismissed, set the hidden property to false.
NilObject
Thanks, but FlipsideView.xib does not have a UINavigationBar. The bar is created programmatically in RootViewController.h, like so:UINavigationBar *aNavigationBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 44.0)];aNavigationBar.barStyle = UIBarStyleBlackTranslucent;self.flipsideNavigationBar = aNavigationBar;[aNavigationBar release];
cannyboy
^ I mean RootViewController.m
cannyboy
Ah, you must be using an older template (a new utility application doesn't have RootViewController). Well, same principle applies -- set hidden to true when showing the picker, set it to false when hiding the picker. You may need an instance variable to point back to the RootViewController.
NilObject
Hmm, not sure how to set up instance variable to point to RootViewController.. Do you mean put IBOutlet RootViewController *rootViewController; in FlipSideView.h (and property, synthesize it)? If so, I'm not sure how to link to to the actual RootViewController? Would it be easier if I did this in the OS 3.0 template?
cannyboy
^ should be 'FlipSideViewController.h'
cannyboy
You don't need to make it an IBOutlet. You would link it by assigning to it right as you show FlipSideViewController in your RootViewController code. But I'm not sure if you need it or not, I was just mentioning it just in case. All you need is to know when you're about to show the image picker, and when the image picker has been dismissed. In those two spots, you can set the hidden property as needed.
NilObject
A: 

I'm going in completely in circles here. There is obviously something fundamental I am not understanding...

In my RootViewController, to load the FlipsideView:

FlipsideViewController *viewController = [[FlipsideViewController alloc] initWithNibName:@"FlipsideView" bundle:nil];
self.flipsideViewController = viewController;

[viewController release];


// Set up the navigation bar
UINavigationBar *aNavigationBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 44.0)];
aNavigationBar.barStyle = UIBarStyleBlackTranslucent;
self.flipsideNavigationBar = aNavigationBar;
[aNavigationBar release];

UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(toggleView)];
UINavigationItem *navigationItem = [[UINavigationItem alloc] initWithTitle:@"App Title"];
navigationItem.rightBarButtonItem = buttonItem;
[flipsideNavigationBar pushNavigationItem:navigationItem animated:NO];
[navigationItem release];
[buttonItem release];

Meanwhile, in my FlipViewController, this shows the image picker:

UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

// THIS IS NOT WORKING
[self.navigationController.navigationBar setHidden:YES];

[self presentModalViewController:picker animated:YES];
[picker release];

I've commented the bit that I thought would remove the navigation bar.

cannyboy
A: 

Inside the animation block where you perform the UIViewTransitionAnimationFlipFromLeft (Or UIViewTransitionAnimationFlipFromRight), add the removal of the navigation bar:

[flipsideNavigationBar removeFromSuperView];

Corey Floyd
There is no animation block with UIViewTransitionAnimationFlipFromLeft
cannyboy
Or UIViewTransitionAnimationFlipFromRight. How are you "flipping" your views? You have to be using an animation block with a UIViewAnimationTransition, it is the only supported way.
Corey Floyd
You're right, it uses UIViewAnimationTransitionFlipFromLeft. However, this is not the issue. The issue is removing the titlebar when the picker is being used. The flip is in RootViewController. I need to remove the titlebar from within FlipsideViewController.
cannyboy