4

I have a PatientTableViewController in the master side of the iPad that has a button for Adding a new patient. It transitions to this NewPatientViewController via a popover segue.

In the NewPatientViewController I have a Done button that delegates back to the PatientTableViewController:

- (void)newPatientViewController:(NewPatientViewController *)sender withZipCode:(NSNumber *)zipCode andFirstName:(NSString *)firstName andLastName:(NSString *)lastName
{
    [self dismissViewControllerAnimated:YES completion:NULL];
    [self dismissModalViewControllerAnimated:YES];
    [sender dismissModalViewControllerAnimated:YES];
    [sender dismissViewControllerAnimated:YES completion:NULL];
}

None of the methods I tried above work. However, if I use a Modal segue, everything works fine. Wat?

Soliah
  • 1,376
  • 2
  • 13
  • 24
Flaviu
  • 6,240
  • 4
  • 35
  • 33

2 Answers2

5

Finally figure it out with the help of this post

Basically, you need to have a variable keep track of the segue (which you need to cast into a UIStoryboardPopoverSegue) and little more weirdness.

I wrote a blog post describing the solution in more detail.

Community
  • 1
  • 1
Flaviu
  • 6,240
  • 4
  • 35
  • 33
4

Did you try dismissPopoverAnimated: on UIPopoverController class?

colbadhombre
  • 803
  • 8
  • 11
  • Thanks man. I tried that but did not know on which property to call it. I finally stumbled on [this post](http://stackoverflow.com/questions/8225589/ios-create-an-popover-view-using-storyboard) which helped me figure it out. – Flaviu Feb 13 '12 at 01:07
  • I haven't worked with storyboards yet, so I was just shooting in the dark. – colbadhombre Feb 13 '12 at 16:03