2

使用故事板,我使用模态样式和表单演示创建到另一个视图控制器的过渡。但始终具有相同的大小。

如何使用情节提要更改此视图控制器大小?我发现了一些几乎可以工作的代码,但我从来没有让 mu modal view controller 居中。 如何调整 UIModalPresentationFormSheet 的大小? 请注意,我使用情节提要,并且该代码不适用于情节提要。

你有什么想法或建议吗?

顺便说一句,prepareForSegue os 似乎调用了 BEFORE viewDidLoad,这正常吗?

非常感谢您的回复。

4

2 回答 2

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

希望我在某些方面对您有所帮助。

问候,史蒂夫

于 2012-07-05T15:31:23.863 回答
1

我最近遇到了同样的问题,并且能够使用此属性更改表单视图的大小:

在此处输入图像描述

于 2014-10-03T13:43:50.870 回答