1

One of the view controllers in my iPad app is a questionnaire form. I'm trying to present it so that it appears in a childViewController modal segue just like the default segue for MFMailComposeViewController.

This is the look I am trying to achieve:

enter image description here

The code I am using doesn't seem to be working:

AskQuestionViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"AskQuestionViewController"];
[self addChildViewController:vc];
vc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self.splitViewController presentViewController:vc animated:YES completion:nil];
denvdancsk
  • 3,033
  • 2
  • 26
  • 41
  • Why are you adding it as a child? What, specifically, doesn't work? – Wain Oct 29 '13 at 22:43
  • Whenever I run my code it crashes. I am trying to achieve the same modal segue that is the default for when you present a MFMailComposeViewController. It is my understanding that the way to achieve this is to add it is a childviewcontroller. I may be wrong of course. – denvdancsk Oct 29 '13 at 22:45
  • Don't add it as a child and give details of the exception (stack trace and message). – Wain Oct 29 '13 at 22:47
  • When I don't add it as a child it does a modal segue just fine but I'm trying to achieve this overlay segue look like the one in the image instead. Whenever you present a MFMailComposeViewController view controller you get that look. – denvdancsk Oct 29 '13 at 22:52

1 Answers1

4

Try:

AskQuestionViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"AskQuestionViewController"];
vc.modalPresentationStyle = UIModalPresentationPageSheet;
[self.splitViewController presentViewController:vc animated:YES completion:nil];
Léo Natan
  • 56,823
  • 9
  • 150
  • 195
  • It works! When I first tried it I put it as a modalTransitionStyle instead of a modalPresentationStyle. I can't believe how easy it was. Thanks! – denvdancsk Nov 05 '13 at 19:19