0
votes

I have popover with navigation controller inside, then I present ABPeoplePickerNavigationController inside this popover via:

self.abPicker.modalPresentationStyle = UIModalPresentationCurrentContext;
self.abPicker.modalInPopover = YES;
[self presentModalViewController:self.abPicker animated:YES];

The problem is that the popover can't be dismissed in this stage, when I press outside popover's area, nothing happen.

Any ideas?

1

1 Answers

0
votes

You forgot to assign a delegate (peoplePickerDelegate). Only the delegate events can dismiss the presented view controller, so you absolutely need the delegate. The delegate events will call dismiss... on the ABPeoplePickerNavigationController.

If you didn't want the resulting popover to be modal, then why did you present the ABPeoplePickerNavigationController with presentModalViewController? That is what it means to be modal! You are making it modal and then complaining it's modal; this is like hitting yourself in the face and then complaining your face is being hit. (Not to mention that you also set modalInPopover to YES, so you're hitting yourself in the face twice.)

The usual thing on iPad is to instantiate ABPeoplePickerNavigationController and use it directly as a new popover controller's view controller.