Return to Snippet

Revision: 32484
at September 26, 2010 12:21 by alfredbaudisch


Updated Code
// Define rootController as a UINavigationController, then...:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{    
	// Sets up toolbar above splitview
	rootController.navigationBar.hidden = YES;	

	CGFloat width = rootController.view.frame.size.width;	
	
	NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"toolbar" owner:self options:nil];
	toolbar = (Toolbar *)[nib objectAtIndex:0];
	toolbar.frame = CGRectMake(0,20,width,TOOLBAR_HEIGHT);	
	[rootController.view addSubview:toolbar];
	
	NSMutableArray *array = [NSMutableArray array];
	
	UISplitViewController *splitViewConntroller = [[UISplitViewController alloc] init];
	
	leftViewController = [[LeftViewController alloc] initWithNibName:@"LeftViewController" bundle:nil];	
	[array addObject:leftViewController];
	
	rightViewController = [[RightViewController alloc] initWithNibName:@"RightViewController" bundle:nil];	
	[array addObject:rightViewController];	
	
	[splitViewConntroller setViewControllers:array];

	[rootController setViewControllers:[NSArray arrayWithObject:splitViewConntroller]];
	[splitViewConntroller release];
    
	[window addSubview:rootController.view];
        [window makeKeyAndVisible];
    
        return YES;
}

Revision: 32483
at September 26, 2010 12:20 by alfredbaudisch


Initial Code
// Define rootController as a UINavigationController, then...:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{    
	// Sets up toolbar above splitview
	rootController.navigationBar.hidden = YES;	

	CGFloat width = rootController.view.frame.size.width;	
	
	NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"toolbar" 
												 owner:self options:nil];
	toolbar = (Toolbar *)[nib objectAtIndex:0];
	toolbar.frame = CGRectMake(0,20,width,TOOLBAR_HEIGHT);	
	[rootController.view addSubview:toolbar];	
	[self refreshToolbar:application.statusBarOrientation];
	
	NSMutableArray *array = [NSMutableArray array];
	
	UISplitViewController *splitViewConntroller = [[UISplitViewController alloc] init];
	
	leftViewController = [[LeftViewController alloc] initWithNibName:@"LeftViewController" bundle:nil];	
	[array addObject:leftViewController];
	
	rightViewController = [[RightViewController alloc] initWithNibName:@"RightViewController" bundle:nil];	
	[array addObject:rightViewController];	
	
	[splitViewConntroller setViewControllers:array];

	[rootController setViewControllers:[NSArray arrayWithObject:splitViewConntroller]];
	[splitViewConntroller release];
    
	[window addSubview:rootController.view];
        [window makeKeyAndVisible];
    
        return YES;
}

Initial URL

                                

Initial Description
As default UISplitViewController has to be the root controller. In this snippet, you can have one as a child of a UINavigationController and also an UIToolbar above the SplitViewController! The same as Epicurious app for iPad.

Initial Title
Toolbar above UISplitViewController and UISplitViewController as child of UINavigationController

Initial Tags

                                

Initial Language
Objective C