Hello everyone, I know there are dozens of threads on accomplishing this, but I've tried them all and must be overlooking something stupid.
I have two ViewControllers, a main view controller and a popover view controller. The main controller is the delegate to the popover, and the popover view controller manages the content of the popover. I have it setup so that if a User selects a row in a table displayed in the popover, a method is called in the main controller. I know this portion is working fine. Now I need to determine what to call in order to dismiss the popover once the user selects an item in the table.
This is the Popover Code in the Main Controller:
Code:
-(IBAction)popOverViewCall:(id)sender{
PopOverViewController *myViewControllerForPopover = [[PopOverViewController alloc] initWithNibName:@"PopOverView" bundle:nil ];
UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:myViewControllerForPopover];
self.popoverController = popover;
popoverController.delegate = self;
[popover release];
[myViewControllerForPopover release];
CGPoint point = {20,45}; // Place to put on screen
CGSize size = {120,45}; // A content range (see apple docs)
[popoverController presentPopoverFromRect:CGRectMake(point.x, point.y, size.width, size.height)
inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
-(void) dismissPopover {
NSLog(@"Inside Dismiss Method");
[popoverController dismissPopoverAnimated:NO];
}
And this is the portion of the Popover View controller that executes after the user touches a row in the table:
Code:
MainViewController *myController = [[MainViewController alloc] init];
[myController dismissPopover];
The dismissPopover method is called when the user clicks, but I can't get the darn popover to go away.
Any hints?