2016-04-25 102 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() 或者,您也可以使用乘数来进行百分比布局。