removing bar on top of uiNavigationController?

Discussion in 'iOS Programming' started by dantastic, Mar 16, 2011.

  1. dantastic macrumors 6502a

    dantastic

    Joined:
    Jan 21, 2011
    #1
    I want to remove the top bar of a UINavigation controller.



    Code:
    -(void)viewWillAppear:(BOOL)animated {
    	self.navigationController.navigationBarHidden = YES;
    ...
    
    - (void)tableView:(UITableView *)tableView
    didSelectRowAtIndexPath:(NSIndexPath *)indexPath {	
    	self.navigationController.navigationBarHidden = NO;
    
    I simply hide the navigation bar as the main table view loads and I show it as I push the next view so that I can go back.

    The problem with this approach is that as soon as the back button is pressed the top bar is removed and for the split second while the view is animating (popping) back, I've a big ugly white bar where the back navigation bar was just moments ago.

    I have been setting all possible background colors to black but it's still white. If I can get the color under the navigation bar to be black that would work.
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    Did you consider opening the UINavigationController and seeing if there was a suitable method to animate the hiding? Obviously not as there is such a method:

    setNavigationBarHidden:animated:

    Use this instead of simply setting the property and all will be well.
     
  3. dantastic thread starter macrumors 6502a

    dantastic

    Joined:
    Jan 21, 2011
    #3
    Robbie mate, legend! I really need to learn to read the documentation.

    Cheers!
     

Share This Page