博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
关于ios 8 7 下的模态窗口大小的控制 代碼+場景(mainstoryboard)( Resizing UIModalPresentationFormSheet )...
阅读量:7070 次
发布时间:2019-06-28

本文共 1242 字,大约阅读时间需要 4 分钟。

1 代碼

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];

 

2 場景

 打開態窗體屬性導航器Show Utilities=》找到show the attributes inspector=》修改Presentation +Content size大小(選中user preferred explicit size

 文件瀏覽器快捷鍵 cmd+0    工具欄(utilities)cmd+alt+0

转载于:https://www.cnblogs.com/Rampage/p/4061972.html

你可能感兴趣的文章
阿里最全面试116题:阿里天猫、蚂蚁金服、阿里巴巴面试题含答案
查看>>
elasticsearch的score相关资料(整理)
查看>>
SQL Tune Report&ndash;sqltrpt.sql
查看>>
Cobbler
查看>>
JNI开发极简教程
查看>>
Bugku -代码审计(urldecode二次编码绕过)
查看>>
Auto Layout 使用心得(五)—— 根据文字、图片自动计算 UITableViewCell 高度
查看>>
Linux命令参数详细解析-cp
查看>>
python爬取糗事百科
查看>>
Java 创建文件
查看>>
dubbo之基础应用
查看>>
javax.persistence.RollbackException: Transaction marked as rollbackOnly Ask
查看>>
基于友盟的第三方登录
查看>>
工程师男友如何反窃听?趣聊密码学入门科普
查看>>
Memcached服务级调优
查看>>
TensorFlow中那些鲜为人知却又极其实用的知识
查看>>
12306 售票网站新版验证码识别对抗
查看>>
Maven三种仓库详解
查看>>
使用 json-server 简单完成CRUD模拟后台数据
查看>>
在SAP云平台的CloudFoundry环境下消费ABAP On-Premise OData服务
查看>>