IOS 值得注意的地方
来源:互联网 发布:java接口与安卓对接 编辑:程序博客网 时间:2024/05/02 02:02
- - (void)loadView
- {
- CGRect applicationFrame = [[UIScreen mainScreen] applicationFrame];
- UIView *contentView = [[UIView alloc] initWithFrame:applicationFrame];
- contentView.backgroundColor = [UIColor blackColor];
- self.view = contentView;
- levelView = [[LevelView alloc] initWithFrame:applicationFrame viewController:self];
- [self.view addSubview:levelView];
- }
关于loadView方法的重写,官方文档中有一个明显的注释,原文如下:
Note: When overriding the loadView
method to create your views programmatically, you should not call super
. Doing so initiates the default view-loading behavior and usually just wastes CPU cycles. Your own implementation of the loadView
method should do all the work that is needed to create a root view and subviews for your view controller.
意思是当通过代码方式去创建你自己的view时,在loadView方法中不应该调用super,如果调用[super loadView]会影响CPU性能。
2.
1,如果是从代码层面开始使用Autolayout,需要对使用的View的translatesAutoresizingMaskIntoConstraints的属性设置为NO.
即可开始通过代码添加Constraint,否则View还是会按照以往的autoresizingMask进行计算.
而在Interface Builder中勾选了Ues Autolayout,IB生成的控件的translatesAutoresizingMaskIntoConstraints属性都会被默认设置NO.
- IOS 值得注意的地方
- 值得注意的地方
- 一些值得注意的地方
- Tuscany值得注意的地方
- JavaSE值得注意的地方
- JS的几个值得注意的地方
- Unix C语言值得注意的地方
- 一个宏定义值得注意的地方
- sql 语句值得注意的地方
- 使用XML值得注意的几个地方
- ssh 框架搭建值得注意的地方
- Win32 SDK值得注意的地方
- shared_from_this 几个值得注意的地方
- c++ 函数值得注意的地方!
- 【Boost】boost::shared_from_this值得注意的地方
- 关于oracle hint 值得注意的地方
- shared_from_this 几个值得注意的地方
- boost::shared_from_this值得注意的地方
- Leetcode NO.19 Remove Nth Node From End of List
- 黑马程序员--java--多态和内部类
- hdu 多校
- SEL数据类型的简单知识点——和方法有关
- 实现简单HTTP服务器-图片与CGI
- IOS 值得注意的地方
- HDU 1017 A Mathematical Curiosity
- 从ValueType讨论c#的值类型系统
- openlayers3使用总结
- STL学习
- 定期iOS的后台位置更新-- 相关资料收集,待有时间进行整理
- Eclipse中c开发printf无法输出解决办法
- MSDN订阅用户可以下载Windows 10正式版啦
- 黑马程序员--java--异常