iphone-presentModalViewController是否可以全屏显示?

iphone-presentModalViewController是否可以全屏显示?,iphone,Iphone,我有一个视图控制器,我正在演示它的模式,如 UIViewController *myWindow = [[UIViewController alloc] init]; CGRect myFrame = CGRectMake(0.0f, 0.0f, 115.0f, 120.0f); myWindow.view.frame = myFrame; [self presentModalViewController:myWindow animated:YES]; 有什么方法可以不以特定尺寸全屏显示吗?

我有一个视图控制器,我正在演示它的模式,如

UIViewController *myWindow = [[UIViewController alloc] init];
CGRect myFrame = CGRectMake(0.0f, 0.0f, 115.0f, 120.0f);
myWindow.view.frame = myFrame;

[self presentModalViewController:myWindow animated:YES];

有什么方法可以不以特定尺寸全屏显示吗?

没有“标准”的方法可以做到这一点

我通过使用
UIActionSheet
并将视图控制器的视图设置为作为actionsheet的子视图,然后重置actionsheet的边界来伪造它。这是一个相当奇怪的黑客,我不推荐它

sheet = [[UIActionSheet alloc] initWithTitle:nil delegate:nil cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil];
sheet.actionSheetStyle = UIActionSheetStyleBlackTranslucent;

UIViewController *modalController = [[UIViewController alloc] initWithNibName:@"SomeNib" bundle:nil];

sheet.autoresizesSubviews = NO;
[sheet addSubview:modalController.view];
[sheet showInView:self.view];
[UIView beginAnimations:nil context:nil];
[sheet setBounds:CGRectMake(0, 0, 320, 728)];
[UIView commitAnimations];

这里的明显缺点是不会触发正常的视图控制器事件(
视图将出现:
视图显示:
,等等)

不容易,但可以使其看起来更小:)


只需在xib全屏上创建根视图,但背景清晰透明。然后,在它的内部,使您的“真实”UI对象任意大小。

据我所见,当模式演示完成时,后面的视图被卸载,导致它变黑。啊,是的,它可能会这样做。爆炸。哦,看来你的路是唯一的路!