1

I am displaying a UIPopoverView using the code:

selectClientPopController= [[UIPopoverController alloc]initWithContentViewController: [self.storyboard instantiateViewControllerWithIdentifier:@"navControllerMini"]];
selectClientPopController.popoverContentSize=CGSizeMake(500, 700);
selectClientPopController.delegate=self;
[selectClientPopController presentPopoverFromRect:CGRectMake(cell.frame.origin.x+120-scrollView.contentOffset.x, cell.frame.origin.y+120,cell.frame.size.width, cell.frame.size.height) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionLeft | UIPopoverArrowDirectionRight animated:YES];

This navigation view controller is ued to step through a two TableViewControllers as shown below:

StoryboardImage

When a cell on the last tableView is pressed, I would like to dismiss the whole popover. I understand that this probably needs to be done using delegates, however I do not know where to assign the delegates in order to achieve this. Thanks for the help.

Ignacy Debicki
  • 437
  • 4
  • 18

1 Answers1

0

Why Not

 // Listen for TableView row selection by setting up delegate. 
 // Basically self if you set the delegate in the same view controller
 YourTableView.delegate = YourViewControllerObjectWhichHasTableView;


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

    [selectClientPopController dismissPopoverAnimated:YES];

}

Whenever u need to dismiss the popover just use the above method. Refer the Apple's Documentation

  • I know that that dismisses the popoverViewController, however this method needs to be called from the view controller that presented the popover – Ignacy Debicki Aug 18 '14 at 12:06