tags:

views:

33

answers:

1

Hi,

I developing an application in which initially choose UINavigationController based application. In rooViewController xib i added two more UIView, the code is written as follows.

@implementation RootViewController @synthesize introductionView, WheelView;

  • (void)viewDidLoad { [super viewDidLoad]; [self.navigationController setNavigationBarHidden:YES]; }

pragma mark

pragma mark strart up screen:

-(void)startIntroductionScreen{ if(window == nil) { window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, 320, 480)]; } [window addSubview: introductionView]; [window makeKeyAndVisible]; }

-(void)WheelScreen{ [window addSubview:carnivalWheelView]; [window makeKeyAndVisible]; self.navigationController.navigationBar.hidden = NO;
[self.navigationItem setLeftBarButtonItem:[[UIBarButtonItem alloc] initWithTitle:@"Setting" style:UIBarButtonItemStylePlain target:nil action:nil] animated:YES]; }

pragma mark

pragma mark IBAction:

-(IBAction)breakGlass:(id)sender{ [self startIntroductionScreen]; }

-(IBAction)anotherView:(id)sender{ [self WheelScreen]; }

In above code, when the -(void)WheelScreen method on the IBAction anotherView of invoke the UINaviagtionBar is not displaying.

Thank's in advance.

A: 

Hi you are adding your view directly to the Window, and it probably has the height 480 px? This means you are covering up the navigationController with the carnivalWheelView.

The carnivalWheel should be a subclass of UIViewController, you should then add it to the navigationController instead of the window.

CarnivalWheel *cw = [[CarnivalWheel alloc] init];
[self.navigationController pushViewController:cw animated:YES];
[cw release];

Now the CarnivalWheel is a "child" of the navigationController and will not cover it with its view.

RickiG
@RickiG, there is no any why to displaying the NavigationController on UIView.I do want to added extra nib for CarnivalWheel.
RRB
You can do: [self.view addSubView:[aViewController view]]; to display a viewControllers view as a sub view of a view! (a lot of "views" there..) :)
RickiG