Related Posts Plugin for WordPress, Blogger...
This form does not yet contain any fields.

    Follow Me on Pinterest

    Our products are on iTunes!

     Nanaimo Studio

    Find us on Google+ 

     

    We are listed on: Dmegs Link Directory

    Blog Index
    404 page

    Entries in navigation controller (1)

    Wednesday
    Jun302010

    Modal Form Sheet + Navigation Controller

    This quick tutorial shows you how to create a modal form sheet with a navigation controller to display master-detail view for your iPad application.  Basic knowledge of iPhone programming is assumed. Download the sample code here.

    Step 1) Create a navigation controller and initialize it with the first view controller (TestModalViewController in this case) to show.
    Step 2) Present the navigation controller as modal.

    
            // Step 1
            TestModalViewController *viewController = [[[TestModalViewController alloc] initWithNibName:@"TestModalViewController" bundle:nil] autorelease];
    	modalViewNavController = [[UINavigationController alloc] initWithRootViewController:viewController];
    
            // Step 2
    	modalViewNavController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    	modalViewNavController.modalPresentationStyle = UIModalPresentationFormSheet;
    	
    	[self presentModalViewController:modalViewNavController animated:YES];
    
    





    3) In TestModalViewController, create a done button for the modal form sheet.

    - (void)viewDidLoad {
    	[super viewDidLoad];
    	
    	self.title = @"Modal Form Sheet Test";
    	self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismiss)];
    }
    
    - (IBAction)dismiss
    {
    	[self.parentViewController dismissModalViewControllerAnimated:YES];
    }
    
    
    

    4) Write the code to push the detail view (TestModalDetailViewController) into the navigation stack (in this case when user taps the Show Details button).

    - (IBAction)showDetails
    {
    	TestModalDetailViewController *viewController = [[[TestModalDetailViewController alloc] init] autorelease];
    	[self.navigationController pushViewController:viewController animated:YES];
    }