我试图将模式 View Controller 显示为UIPresentationFormSheet。该 View 出现了,但我似乎无法调整其大小。我的XIB具有适当的高度和宽度,但是当我这样称呼它时,它似乎被覆盖了:

composeTweetController = [[ComposeTweet alloc] initWithNibName:@"ComposeTweet" bundle:nil];
composeTweetController.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:composeTweetController animated:TRUE];

有什么想法吗?我正在使用iPhone SDK 3.2 beta 4

最佳答案

呈现模态 View 后,您可以对其进行调整:

在iOS 5.1中测试-7.1

MyModalViewController *targetController = [[[MyModalViewController alloc] init] autorelease];
targetController.modalPresentationStyle = UIModalPresentationFormSheet;
targetController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;  //transition shouldn't matter
[self presentViewController:targetController animated:YES completion:nil];

if(floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1){
     targetController.view.superview.frame = CGRectInset(targetController.view.superview.frame, 100, 50);
}else{
     targetController.view.frame = CGRectInset(targetController.view.frame, 100, 50);
     targetController.view.superview.backgroundColor = [UIColor clearColor];
}

关于iphone - 如何调整UIModalPresentationFormSheet的大小?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/2457947/

10-11 06:40