Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>1st Suggestion: </p> <p>Make one mainController and add the buttons(depends on how many viewController you have), when button clicked each button will load different viewController. </p> <pre><code>// appDelegate.h @property (strong, nonatomic) UIWindow *window; @property (strong, nonatomic) MainViewController *mainController; //appDelegate.m self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; self.mainController = [[[MainViewController alloc] initWithNibName:@"MainViewController" bundle:nil] autorelease]; self.window.rootViewController = self.viewController; //each button clicked has following IBAction: -(IBAction)button1Clicked:(id)sender { FirstViewController *firstVC = [[FirstViewController alloc]initWithNibName:@"FirstViewController" bundle:[NSBundle mainBundle]]; UINavigationController *navController = [[[UINavigationController alloc] initWithRootViewController:firstVC]autorelease]; [self presentModalViewController:navController animated:NO]; [addVC release]; } //in FirstViewController.m -(void)viewDidLoad { [super viewDidLoad]; self.title = @"xxxx "; self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel_Clicked:)]autorelease]; } -(void) cancel_Clicked:(id)sender { [self dismissModalViewControllerAnimated:YES]; } </code></pre> <p>Note : </p> <p>ViewController to be embedded inside a navigation controller, the following code has to be used;</p> <pre><code>UINavigationController *navController = [[[UINavigationController alloc] initWithRootViewController:firstVC]autorelease]; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload