Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

hotwire132002

macrumors 65816
Original poster
Jan 24, 2004
1,209
1
Cadillac, MI
I'm working on my first iPad app that utilizes a popover view, and I'm trying to figure out how to update the "parent" view once an item is selected from the popover.

Right now, the popover view is called as follows (from within FeedsDetailViewController.m):

Code:
FeedsViewController* content = [[FeedsViewController alloc]  initWithTitle:@"Title" withNavigationTitle:@"NavTitle" withPropertyFile:propFile withNavType:@"popover"];
		UIPopoverController* aPopover = [[UIPopoverController alloc]
										 initWithContentViewController:content];
		
		aPopover.delegate = self;
		[content release];
		
		
		// Store the popover in a custom property for later use.
		self.popoverController = aPopover;
		[aPopover release];
		
	
		[self.popoverController presentPopoverFromBarButtonItem:sender
									   permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
		}

This particular view is also used in a Split View as the main navigation controller. When it's used as the navigation controller in the SplitView, the following code is called to update the "detail" portion of the SplitView (from within FeedsViewController.m):

Code:
UISplitViewController *split = (UISplitViewController *)self.navigationController.parentViewController;
					UINavigationController *nav = [split.viewControllers objectAtIndex:1];
					FeedsDetailViewController *detail = [nav.viewControllers objectAtIndex:0];
					
					// Push in the new article
					FeedsDetailViewController *fdvController = [[FeedsDetailViewController alloc] initWithDictionary:itemDictionary withPropertyFile:passPropFile];
					
					[detail.navigationController pushViewController:fdvController animated:YES];
						[fdvController release];

That code works fine in the split view, but I can't figure out how to update the "detail" view controller (FeedsDetailViewController) from the popover. Addressing self.navigationController.parentViewController doesn't do any good; is there a different "parent" view I might need to push the new FeedsDetailViewController into?

Thanks in advance for any help you can provide....
 
Have you looked at the code for a simple Split-View Based app template? It pretty much does almost all you're asking for.

You mean Apple's MultipleDetailViews example? I have looked at that; I'll look it over more closely tomorrow though ;-)
 
You mean Apple's MultipleDetailViews example? I have looked at that; I'll look it over more closely tomorrow though ;-)
No, I mean create a new project using the Split-View Based template. The basic project it creates has code that updates the detail view when selections are made from the root view, whether it's the left-side of a landscape split view or the popover of a portrait mode. But maybe I'm not understanding what exactly it is that you're asking.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.