views:

23

answers:

2

Hi all ,

  1. My app have AppDelegate ----> added MyViewController.view
  2. MyViewController contains UINavigationController, i.e. MyViewController.view = MyViewController.aNavigationController.view
  3. With this I able to see the added view correctly

  1. Then I created a NextViewController
  2. Added one button to MyViewController with action
  3. On button click , i wrote code for navigating to next view using pushViewController
  4. But it's not working, After clicking button the same view is getting displayed

Please help, if anybody gone through same issue and resolved it.

Is it possible to add navigation controller to a view controller?

A: 

//As you are not providing what you are implementing in you code so it difficult to say what is you problem

Solution:

//First import the NextViewContoller.h in your MyViewController.m

//Then implement this method in your application

-(IBAction)goToNext:(id)sender{

NextViewContoller *nxt=[[NextViewContoller alloc]init];

[self.navigationController pushViewController:nxt animated:YES];

}

//Finally release nxt in dealloc

raaz
A: 

Hi .. thanks for reply ...

I tried by the way u specified here i.e. 1. Added a UINavigationController to MyViewController using IB 2. Created outlet for UINavigation controller in MyViewcontroller.h 3. Did required connection for IBOutlet, also created IBAction for button 4. Then On button click , created object of NextViewController and push the next view controller to navigation controller 5. But still , App window shows the current view and do not displays the next view


My query is that , can we add a navigation controller to this "MyViewController" i.e. UIViewController ???

Kranti Bhange