gpt4 book ai didi

iphone - 如何调整 UIModalPresentationFormSheet 的大小?

转载 作者:IT老高 更新时间:2023-10-28 11:39:02 27 4
gpt4 key购买 nike

我正在尝试将模态视图 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

最佳答案

您可以在展示模态视图后调整它的框架:

在 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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com