I am interested to know on how I can resize the view when using UIModalPresentationFormSheet
of modalPresentationStyle
, it looks like it has a fixed size so I was wondering if anyone out there did managed to manipulate the popup view from the sizing perspective.
So there is either UIModalPresentationFormSheet
with a fixed view size or full views and I am after something in between.
For iOS 8, simply implement the delegate method (CGSize)preferredContentSize on each view controller. It should resolve all the size issue.
You are able to adjust the frame of a modal view after presenting it:
Tested in iOS 5.1 - 6.1, using XCode 4.62
Update The preferred iOS 6.0 view controller presentation method also works correctly:
I put this code in the form sheet view controller:
Note that the resizing occurs early enough that the the presentation animation looks correct.
In ios8 and earlier works:
In AboutViewController.m
IS_IOS8
In iOS 8 you can also use UIPresentationController which gives you more customization options.
Just to extent Fatos solution (great one) If your are creating the view controller using a .xib file after the alloc initWithNibName you could store the view frame:
And then use it for superview.bounds, so the view's size in the .xib will be used and you could change the size more visually.