用代碼佈局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方法

相關文章
相關標籤/搜索