如何调整 UIModalPresentationFormSheet 的大小? [英] How to resize a UIModalPresentationFormSheet?
本文介绍了如何调整 UIModalPresentationFormSheet 的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将模态视图控制器显示为 UIPresentationFormSheet.视图出现,但我似乎无法调整它的大小.我的 XIB 有合适的高度 &宽度,但当我这样称呼它时,它似乎被覆盖了:
I am trying to display a modal view controller as a UIPresentationFormSheet. The view appears, but I can't seem to resize it. My XIB has the proper height & width, but it seems to get overridden when I call it like this:
composeTweetController = [[ComposeTweet alloc] initWithNibName:@"ComposeTweet" bundle:nil];
composeTweetController.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:composeTweetController animated:TRUE];
有什么想法吗?我使用的是 iPhone SDK 3.2 beta 4
Any thoughts? I am using the iPhone SDK 3.2 beta 4
推荐答案
你可以在展示一个模态视图后调整它的框架:
You are able to adjust the frame of a modal view after presenting it:
在 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];
}
这篇关于如何调整 UIModalPresentationFormSheet 的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文