用代码布局autoLayout

手写布局,必须设置translatesAutoresizingMaskIntoConstraints为NO,若是用xib,xib会把view的translatesAutoresizingMaskIntoConstraints设置为NO.布局

@interface UIView (UIConstraintBasedCompatibility) ui

translatesAutoresizingMaskIntoConstraints.net

autlayout rem

若是是从代码层面开始使用Autolayout,须要对使用的ViewtranslatesAutoresizingMaskIntoConstraints的属性设置为NO.
便可开始经过代码添加Constraint,不然View仍是会按照以往的autoresizingMask进行计算.
而在Interface Builder中勾选了Ues Autolayout,IB生成的控件的translatesAutoresizingMaskIntoConstraints属性都会被默认设置NO.get

下面方法是把一个viewController的view加到另外一个viewController的view上时能够用的。之后详细补充。it

@interface UIViewController (UIContainerViewControllerProtectedMethods)class

- (void)addChildViewController:(UIViewController *)childController sed

- (void) removeFromParentViewController方法

相关文章
相关标签/搜索