2014-05-05 63 views
4

在UIView.h您可以閱讀以下內容:translatesAutoresizingMaskIntoConstraints和IB

/* by default, the autoresizing mask on a view gives rise to constraints 
    that fully determine the view's position. Any constraints you set on 
    the view are likely to conflict with autoresizing constraints, 
    so you must turn off this property first. IB will turn it off for you. 
*/ 
- (BOOL)translatesAutoresizingMaskIntoConstraints NS_AVAILABLE_IOS(6_0); // Default YES 

因此,這意味着,當你從廈門國際銀行創建UIViewtranslatesAutoresizingMaskIntoConstraints應設置爲NO

但是,當我使用[[UINib nibWithNibName:nibName bundle:[NSBundle mainBundle]] instantiateWithOwner:self options:nil]創建一個xib視圖時,translatesAutoresizingMaskIntoConstraints設置爲YES

任何想法爲什麼?

+0

如果在nib中設置複選標記AutoLauOut,則將設置translatesAutoresizingMaskIntoConstraints –

+0

已檢查xib文件中的「Use Autolayout」複選框。 – MartinMoizard

+0

@MartinMoizard,你發現答案了嗎? – Blaz

回答

1

事實證明,這是一個已經在蘋果的bug記者提交的bug。它應該在未來的版本中修復。