码迷,mamicode.com
首页 > 其他好文 > 详细

UIView

时间:2015-09-20 08:08:36      阅读:141      评论:0      收藏:0      [点我收藏+]

标签:

UIView的layout有三种方式:

1、手动计算

2、Autoresizing

       代码创建的view默认使用autoresizing  

       设置父View的autoresizeSubviews属性为false,则子view不使用autoresizing;

       Autoresizing发生在layoutSubviews方法执行之前

3、Autolayout

       代码创建view 添加constraints

       勾选xib或者storyboard的 Use AutoLayout 的checkbox,则此xib或storyboard中的view都会使用autolayout

       UIView的子类,requiresConstraintsBasedLayout方法返回true,则此View使用Autolayout

       如果一个子View使用autolayout,则他所有的父View都会使用autolayout;一个ViewController的mainview使用autolayout布局,则改ViewController会收到相关的   autolayout-related事件;

      

UIView

标签:

原文地址:http://www.cnblogs.com/jxcl/p/4822813.html

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