autolayout学习笔记_2
来源:互联网 发布:银行家算法java代码 编辑:程序博客网 时间:2024/05/16 01:36
一个在控制面板获取autolayout的_autolayoutTrace的小技巧
add the debugging code to ViewController.m:
@interface UIWindow (AutoLayoutDebug) + (UIWindow *)keyWindow;- (NSString *)_autolayoutTrace;@end
And:
- (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; NSLog(@"%@", [[UIWindow keyWindow] _autolayoutTrace]); }- (void)didRotateFromInterfaceOrientation: (UIInterfaceOrientation)fromInterfaceOrientation{ [super didRotateFromInterfaceOrientation: fromInterfaceOrientation]; NSLog(@"%@", [[UIWindow keyWindow] _autolayoutTrace]); }
I like to have this tracing code in there so that it’s easy to spot ambiguous layouts. Interface Builder works hard to prevent you from making mistakes, but when you’re building up your constraints programmatically, you can do all sorts of things wrong.
Sometimes your layout may even appear to work just fine, but then you do an _autolayoutTrace and it actually says AMBIGUOUS LAYOUT. You want to catch such errors before you ship your app to customers. It’s better to be on the safe side, especially when you’re just starting out with Auto Layout.
0 0
- autolayout学习笔记_2
- Swift学习笔记_2
- EasyUI学习笔记_2
- Autolayout学习笔记
- autolayout sizeclass学习笔记
- Android AutoLayout 学习笔记
- ZigBee学习笔记_InitBoard()_2
- ZigBee学习笔记_HalDriverInit()_2
- 学习要点笔记---多线程_2
- autolayout size class学习笔记
- Linux学习笔记_常用操作_2
- proxy学习笔记(动态代理)_2
- LoadRunner学习笔记(脚本开发_2)2
- 云计算核心技术剖析学习笔记_2
- oracle 11g 学习笔记 11_2
- 黑马程序员-java学习笔记-高新技术_2
- python_学习笔记_基础练习_2
- 机器学习笔记_ 降维_2:PCA
- Java NIO系列教程(四) Scatter/Gather
- [Python]网络爬虫(五):urllib2的使用细节与抓站技巧
- 第十二周项目4——(5)
- git步步进阶---集中式与分布式区别
- Python模块之urllib和urllib2之间的区别
- autolayout学习笔记_2
- OC 异常处理
- 调用css时,用link 和 @import url 有什么区别
- java 四舍五入保留小数
- Notification类的问题
- 关于鱼雷高速空投弹道仿真
- 没有运营资源,怎样让产品运营起来?【诸葛】
- C++经典面试题
- Windows与虚拟机上的Linux通信测试失败