So I have a very basic UIPresentationController that basically display contentView centered on screen, it's size is determined by view controller preferredContentSize. (Its very much similar to regular modal view controller presented as FormSheet).
What I'm trying to achieve, is to be able to update size of this view controllers' view dynamically, by just changing it's preferredContentSize.
When I set preferredContentSize, my subclass of UIPresentationController receive information about it in:
-(void)preferredContentSizeDidChangeForChildContentContainer:(id<UIContentContainer>)container
But how can I from here resize the view frame with animation ? If I just call:
-(void)preferredContentSizeDidChangeForChildContentContainer:(id<UIContentContainer>)container
{
[UIView animateWithDuration:1.0 animations:^{
self.presentedView.frame = [self frameOfPresentedViewInContainerView];
} completion:nil];
}
Immediately gets called containerViewWillLayoutSubviews and frame is changed without animation.
-(void)containerViewWillLayoutSubviews
{
self.presentedView.frame = [self frameOfPresentedViewInContainerView];
}
Please help me find a way, to resize it with animation. It must be possible, since it resizes with animation for example when rotation happens.