0

I use UIStoryboardSegue

- (void)perform
{
    [(UIViewController *)self.destinationViewController setModalPresentationStyle:UIModalPresentationFormSheet];
    [(UIViewController *)self.destinationViewController setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
    [(UIViewController *)self.sourceViewController presentViewController:self.destinationViewController animated:YES completion:nil];
}

Then in destinationViewController value for parentViewController is nil. How it possible, and how to get sourceViewController in destinationViewController using UIModalPresentationFormSheet?

4

1 回答 1

1

See the documentation. Going from your code sniplet, parentViewController should be nil because it is not imbedded in a containter view of its parentView. Did you mean presentingViewController?

Ahh... It changed with iOS 5. In earler versions parentViewController did return the presenting view controller if it did not have a parent. Now it returns nil. You should use preseningViewController instead.

于 2013-07-26T14:49:41.827 回答