views:

669

answers:

1

I have a UIPopOverController that shows a UIViewController with a UITableview in its view. The cells in the table have a detailedView, but whenever that view gets pushed, the PopOverController increases in size, and I am left with all this white space inside it.

Question is this: Can anyone show me how I can have a Master/Detail UITableview show inside a PopOverController whilst preserving its dimensions?

Some of my code if it helps you:

//Creating the PopOver with the UIViewController    
addTaskViewController = [[AddTaskViewController alloc] initWithNibName:@"AddTaskViewController" bundle:nil];
 UINavigationController *addTaskNavController = [[UINavigationController alloc] initWithRootViewController:addTaskViewController];
 UIPopoverController *addTaskPopOver = [[UIPopoverController alloc] initWithContentViewController:addTaskNavController];
 self.addTaskPopOverController = addTaskPopOver;
 addTaskPopOverController.delegate = self;
 //...neccessary releases...

//Showing the popover when a button is pressed
- (void) addTasksButtonPressed:(id)sender {
 //Display the Popover containing a view from AddTaskViewController 
 [self.addTaskPopOverController setPopoverContentSize:CGSizeMake(400, 700)];
 [addTaskPopOverController presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}
+2  A: 

You should set the detail view controller's contentSizeForViewInPopover property to the same value as the parent controller.

Martin Gordon
Martin, can you elaborate? Do you mean the detail view controller for my UITableView should have its property set as the root view controller for the UITableView?
Tilo Mitra
Figured it out! Thanks a lot Martin. To those who have the same problem, for both ViewControllers in your UITableView (Master and Detail), set its contentSizeForViewInPopover property to the CGSize set in your RootViewController (where you are launching the popup from)
Tilo Mitra