Search code examples
iosxcode4ios5ipad-2

iOS : How to link a mainViewController.XIB to another page called about.XIB with a button to press?


I have my iPad ViewController.xib with a button called about us. How to link that button to another page called about us. I have created one XIB file called about.xib. And how do i link that page. Also can I link back to the main viewController. Do i need to create another m or h files?

I have done this code but it doesn't work.

- (IBAction) About {
    UIViewController * about = [[UIViewController alloc] initWithNibName:@"About" bundle:nil];
    [self.navigationController pushViewController:about animated:YES];
    [about release];
}

Solution

  • UIViewController * about = [[UIViewController alloc] initWithNibName:@"About" bundle:nil];
    [self presentModalViewController:about animated:YES];
    [about release];