http://blog.csdn.net/nogodoss/article/details/17246489app
一,NSLayoutConstraint APIide
1,constraintsWithVisualFormat:ui
+ (NSArray *)constraintsWithVisualFormat:(NSString *)format options:(NSLayoutFormatOptions)opts metrics:(NSDictionary *)metrics views:(NSDictionary *)views;
參數介紹:編碼
format:此參數爲你的vfl語句,好比:@"H:|-[button]-|" spa
水平方向 H: 垂直方向 V: .net
Views [view] SuperView | code
關係 >=,==,<=orm
空間,間隙 -blog
優先級 @value事件
opts:枚舉參數,默認寫0,具體跟據你所實現的需求去選擇你想要的枚舉
metrics:這裏是一個字典,當在format中使用了動態數據好比上現這句:@"H:|-[button(==width)]-|",表示這個button的寬度爲width,那麼這個參數去哪裏找呢?就是在這個字典裏面找到key對就的值,若是沒有找到這個值,app就會crash.
views:顧名思義,這是傳全部你在vfl中使用到的view,那在上面這句例子中的應該怎麼傳呢?結果是這樣的:NSDictionaryOfVariableBindings(button).若是你使用到了多個view,就能夠這樣NSDictionaryOfVariableBindings(button,button1,button3...),這個名字也要跟參數format中的一一對應,缺一不可.
2, addConstraint:
- (void)addConstraint:(NSLayoutConstraint *)constraint NS_AVAILABLE_IOS(6_0); // This method will be deprecated in a future release and should be avoided. Instead, set NSLayoutConstraint's active property to YES. - (void)addConstraints:(NSArray *)constraints NS_AVAILABLE_IOS(6_0); // This method will be deprecated in a future release and should be avoided. Instead use +[NSLayoutConstraint activateConstraints:]. - (void)removeConstraint:(NSLayoutConstraint *)constraint NS_AVAILABLE_IOS(6_0); // This method will be deprecated in a future release and should be avoided. Instead set NSLayoutConstraint's active property to NO. - (void)removeConstraints:(NSArray *)constraints NS_AVAILABLE_IOS(6_0); // This method will be deprecated in a future release and should be avoided. Instead use +[NSLayoutConstraint deactivateConstraints:].
eg:
3,
http://www.ifun.cc/blog/2014/02/21/dong-tai-ji-suan-uitableviewcellgao-du-xiang-jie/#md-5