码迷,mamicode.com
首页 > 移动开发 > 详细

关于ios 8 7 下的模态窗口大小的控制( Resizing UIModalPresentationFormSheet )

时间:2014-10-30 10:49:58      阅读:2680      评论:0      收藏:0      [点我收藏+]

标签:style   io   color   os   ar   for   sp   on   ef   

UIViewController* modalController = [[UIViewController alloc]init];
modalController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
modalController.modalPresentationStyle = UIModalPresentationFormSheet;

//Resizing size
CGPoint frameSize = CGPointMake([[UIScreen mainScreen] bounds].size.width*0.95f, [[UIScreen mainScreen] bounds].size.height*0.95f);
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenWidth = screenRect.size.width;
CGFloat screenHeight = screenRect.size.height;
if ([[[UIDevice currentDevice]systemVersion] floatValue] >= 8.0 )
{
// Resizing for iOS 8
modalController.preferredContentSize = CGSizeMake(frameSize.x, frameSize.y);
}
else
{
// Resizing for <= iOS 7
modalController.view.superview.frame = CGRectMake((screenWidth - frameSize.x)/2, (screenHeight - frameSize.y)/2, frameSize.x, frameSize.y);
}
UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
[vc presentViewController:modalController animated:YES completion:nil];

关于ios 8 7 下的模态窗口大小的控制( Resizing UIModalPresentationFormSheet )

标签:style   io   color   os   ar   for   sp   on   ef   

原文地址:http://www.cnblogs.com/Rampage/p/4061972.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!