iosuipresentationcontroller

UIPresentationController -- can I update the presented view controller's frame after presentation?


I'm using a custom UIPresentationController subclass to manage the presentation of a UIViewController. I'm overriding - (CGRect)frameOfPresentedViewInContainerView to provide a frame that is inset from the bounds of the containerView.

Now, after some user action on the presentedViewController, I would like to change the frame of the presentedViewController. My question is: Is there a 'natural' way to do this??

How can I adjust the frame of a presentedViewController after it has been presented?


Solution

  • So the way I went about this was to do the following:

    I added implemented the following method from <UIContentContainer>:

    - (void)preferredContentSizeDidChangeForChildContentContainer:(id <UIContentContainer>)container 
    

    I then simply updated the preferredContentSize on my presentedViewController, got the callback, and animated the frame update within the UIPresentationController.