Navigation bar of a modal view dissapear under the current navigation bar

Discussion in 'iOS Programming' started by roeik, Jan 2, 2010.

  1. roeik macrumors member

    Joined:
    Dec 25, 2008
    #1
    Hi,

    Inside the rootviewcontroller of a navigation controller, I am calling a modal view controller, like this:

    Code:
       picker.navigationBar.barStyle = UIBarStyleDefault; 
       [self presentModalViewController:picker animated:YES];
    
    The problem is that the navigationbar of the modal view controller (picker in my case) goes under the existing navigation bar, instead of on top of it.

    I tried everything but I can't figure out what is the problem. Any ideas?

    Thank you.
     
  2. KoolStar macrumors demi-god

    KoolStar

    Joined:
    Oct 16, 2006
    Location:
    Kentucky
    #2
    That is because you are calling on the view that is contained inside the navigation controller, meaning that the view is behind the nav controller.
     
  3. roeik thread starter macrumors member

    Joined:
    Dec 25, 2008
    #3

    So what do I do?

    I tried to this, but nothing happens.
    Code:
     [self.navigationController presentModalViewController:picker animated:YES];
     
  4. KoolStar macrumors demi-god

    KoolStar

    Joined:
    Oct 16, 2006
    Location:
    Kentucky
    #4
    Are you using a toolbar or tabbar in your app at all or is it just a navigation controller.
     
  5. roeik thread starter macrumors member

    Joined:
    Dec 25, 2008
  6. KoolStar macrumors demi-god

    KoolStar

    Joined:
    Oct 16, 2006
    Location:
    Kentucky
    #6
    I just created a sample project that does just that a nav controller, with the code to present a modal view in the root view controller. I used
    Code:
    [self presentModalViewController: animated: ];
    as you did in your first post and it worked just fine.
     

Share This Page