具有自定义视图大小的UIModalPresentationStyle视图

时间:2011-06-14 12:38:47

标签: objective-c ios4 ipad

当您选择“ UIModalPresentationFormSheet ”时,是否可以拥有自定义视图尺寸?现在看起来好像这是我们无法控制的?

根据以下链接,您似乎无法更改默认尺寸。

http://www.thizzer.com/2011/05/uimodalpresentationstyle-frame-size-ipad/

1 个答案:

答案 0 :(得分:3)

MyModalViewController *targetController = [[[MyModalViewController alloc] init] autorelease]; 

targetController.modalPresentationStyle = UIModalPresentationFormSheet;

targetController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; //transition shouldn't matter 

[self presentModalViewController:targetController animated:YES];


targetController.view.superview.frame = CGRectMake(0, 0, 200, 200);//it's important to do this after 


targetController.view.superview.center = self.view.center;