2

Using storyboard, I create a transition to another view controller using modal style and form sheet presentation. But always has the same size.

How can I change this view controller size using storyboard? I found some code that almost work, but I never get mu modal view controller centered. How to resize a UIModalPresentationFormSheet? Note that I use Storyboard and that code is not for storyboard.

Do you have any idea or suggestion?

By the way, it seems prepareForSegue os called BEFORE viewDidLoad, is this normal?

Thanks a lot for replies.

Community
  • 1
  • 1
Ricardo
  • 2,831
  • 4
  • 29
  • 42

2 Answers2

5

Although it's a little late.

I've implemented it before.. I've managed to get UIPresentationFormSheet centered. Here's my code..

[detailView setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[detailView setModalPresentationStyle:UIModalPresentationFormSheet];    
[self presentModalViewController:detailView animated:YES];
detailView.view.superview.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
float heightOfFrame = 200.0f;
float widthOfFrame= 400.0f;
detailView.view.superview.frame = CGRectMake(
    self.view.superview.center.x - (widthOfFrame/2),                                         
    self.view.superview.center.y - (heightOfFrame/2),
    widthOfFrame,
    heightOfFrame
); 

Hope I've helped you in some ways.

Regards, Steve

steve0hh
  • 637
  • 6
  • 15
  • 2
    Thanks for reply. What do you think about using bounds? And, do you have problems when presented view is a navigation controller? It seems these hacks doesn't work when using navigation controllers. – Ricardo Jul 06 '12 at 13:59
1

I had the same problem recently and was able to change the size of the form sheet view using this property:

enter image description here

Bill
  • 44,502
  • 24
  • 122
  • 213