[iPad] Using UISplitViewController with a UITabBarController - UIPopoverController - Question
[iPad] Using UISplitViewController with a UITabBarController - UIPopoverController - Question
- Subject: [iPad] Using UISplitViewController with a UITabBarController - UIPopoverController - Question
- From: Philip Vallone <email@hidden>
- Date: Sun, 07 Nov 2010 16:04:59 -0500
Hi,
I hope I can explain my issue correctly. I have a UISplitViewController which uses a UITabBarController as the Details view. Everything works except on my UITabBarController I can not see the UIPopoverController on the Navigation Bar.
I have a class called DetailViewTabBarController which is the detail view for the Spilt View. The below code is how I am creating the TabBarController and how I implemented the popoverController and Spilt view Protocols.
Thanks for the help.
DetailViewTabBarController.m
- (void)loadView {
UIView *contentView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
contentView.backgroundColor = [UIColor whiteColor];
self.view = contentView;
navigationBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, 1004, 60)];
[contentView release];
FirstViewController *firstViewController = [[FirstViewController alloc] initWithNibName:@"FirstView" bundle:nil];
SecondViewController *secondViewController = [[SecondViewController alloc] initWithNibName:@"SecondView" bundle:nil];
firstViewController.title = @"New Project";
secondViewController.title = @"My Sites";
tabBarController = [[UITabBarController alloc] init];
tabBarController.view.frame = CGRectMake(0, 0, 768, 1004);
// Set each tab to show an appropriate view controller
[tabBarController setViewControllers:[NSArray arrayWithObjects:firstViewController, secondViewController, nil]];
[firstViewController release];
[secondViewController release];
[self.view addSubview:tabBarController.view];
}
#pragma mark -
#pragma mark Managing the popover controller
- (void)setDetailItem:(id)newDetailItem {
if (detailItem != newDetailItem) {
[detailItem release];
detailItem = [newDetailItem retain];
// Update the view.
navigationBar.topItem.title = [detailItem description];
}
if (popoverController != nil) {
[popoverController dismissPopoverAnimated:YES];
}
}
#pragma mark -
#pragma mark Split view support
- (void)splitViewController: (UISplitViewController*)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem*)barButtonItem forPopoverController: (UIPopoverController*)pc {
barButtonItem.title = @"Table of Contents";
[navigationBar.topItem setLeftBarButtonItem:barButtonItem animated:YES];
self.popoverController = pc;
}
- (void)splitViewController: (UISplitViewController*)svc willShowViewController:(UIViewController *)aViewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem {
[navigationBar.topItem setLeftBarButtonItem:nil animated:YES];
self.popoverController = nil;
}
Regards,
Philip Vallone
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden