2016-04-25 70 views

回答

1

嘗試這個
添加以下屬性,您的viewController

@property (strong, nonatomic) IBOutlet NSLayoutConstraint *cnstViewLeading; 
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *cnstViewTrailing; 

然後設置插座,帶你的開頭和結尾的像......


使用這樣

// replace value whatever you want with 0 
    self.cnstViewLeading.constant = 0; 
    self.cnstViewTrailing.constant = 0; 
0

您可以根據您的需要製作NSLayoutContraint的網點並更新其常數。更新常數後,您需要致電view.layoutIfNeeded() 或者,您也可以使用乘數來進行百分比佈局。