UIViewController使用属性modalPresentationStyle
来源:互联网 发布:淘宝客自动赚钱软件 编辑:程序博客网 时间:2024/05/16 12:31
今天在开发过程中发现一个奇怪的现象:
使用下面这段代码界面可以正常弹出,但是界面显示不正常
代码:
TestViewController *abcviewController = [[TestViewControlleralloc]initWithNibName:@"TestViewController"bundle:nil];
abcviewController.modalPresentationStyle =UIModalPresentationFormSheet;
[selfpresentViewController:abcviewController animated:YEScompletion:^{
}];
界面结果:
这里给出这种情况的解决方案:
在界面弹出后,重新修改界面的frame及中心点
代码:
TestViewController *abcviewController = [[TestViewController alloc] initWithNibName:@"TestViewController" bundle:nil];
abcviewController.modalPresentationStyle =UIModalPresentationFormSheet;
[selfpresentViewController:abcviewControlleranimated:YEScompletion:^{
}];
//重要
abcviewController.view.superview.frame = CGRectMake(0, 0, 430, 383);
abcviewController.view.superview.center = CGPointMake(1024/2, 748/2);
这样界面就能按照正确的大小显示在界面的中间了
- UIViewController使用属性modalPresentationStyle
- UIViewController的 modalPresentationStyle 用法
- UIViewController的 modalPresentationStyle 用法
- UIViewController 的属性presentingViewController
- UIViewController的edgesForExtendedLayout属性
- <iOS>UIViewController的edgesForExtendedLayout属性
- iOS UIViewController的edgesForExtendedLayout属性
- iOS开发之UIViewController属性
- UIViewController使用技巧!
- UIViewController使用技巧!
- iOS UIViewController 使用要点
- UIViewController使用技巧!
- UI -- 正确使用UIViewController
- UIViewController使用技巧!
- UIViewController使用技巧!
- 使用UIViewController自定义UITabBarController
- 消失的控制器:modalPresentationStyle
- [iOS]modalPresentationStyle和modalTransitionStyle
- C/C++时间函数的使用
- 图片定期显示
- HEVC 中主要LCU分析函数xCompressCU说明
- 对通用输入输出GPIO的深入理解
- Hive安装配置
- UIViewController使用属性modalPresentationStyle
- 在Chrome OS 上看到一些价值
- 图片浮动
- OpenGL中gl,glu,glut的区别
- POJ3274
- Linux Shell脚本编程基础
- Log4net开源组件的用法心得
- boost::flyweight使用
- 关于Codeblocks中的编译器问题