2012-04-15 42 views
2

使用故事板,我使用模式样式和表单表单创建到另一个视图控制器的转换。但总是有相同的大小。如何在使用故事板显示模态视图控制器时更改尺寸?

如何使用故事板更改此视图控制器大小? 我发现了一些几乎可以工作的代码,但我从来没有获得mu模式视图控制器居中。 How to resize a UIModalPresentationFormSheet? 请注意,我使用Storyboard并且该代码不适用于故事板。

你有什么想法或建议吗?

顺便说一下,它似乎prepareForSegue os调用BEFORE viewDidLoad,这是正常的吗?

非常感谢您的回复。

回答

5

虽然有点晚了。

我已经实现它之前..我设法让UIPresentationFormSheet居中。 这里是我的代码..

[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 
); 

希望我帮助你在某些方面。

问候,史蒂夫

+2

谢谢回复。你怎么看待使用界限?而且,当呈现视图是导航控制器时,你有问题吗?看起来这些黑客在使用导航控制器时不起作用。 – Ricardo 2012-07-06 13:59:51

1

最近我有同样的问题,并能够更改使用此属性的形式表视图的大小:

enter image description here

相关问题