********************** 一 //textAlignment:文字的 水平方向 对齐 ***********************
NSTextAlignmentLeft 左对齐
NSTextAlignmentCenter 居中
NSTextAlignmentRight 右对齐
能显示文字的控件一般都有这个属性,
如:label.textAlignment//
textField.textAlignment //
textView.textAlignment//
********************* 二 //内容的对齐 ***************
(1) contentVerticalAlignment:内容的 垂直方向 对齐
typedef NS_ENUM(NSInteger, UIControlContentVerticalAlignment) {
//竖直方向 居中对齐
UIControlContentVerticalAlignmentCenter = 0,
//顶部对齐
UIControlContentVerticalAlignmentTop = 1,
//底部对齐
UIControlContentVerticalAlignmentBottom = 2,
//
UIControlContentVerticalAlignmentFill = 3,
};
(2) contentHorizontalAlignment:内容的 水平方向 对齐
typedef NS_ENUM(NSInteger, UIControlContentHorizontalAlignment) {
//水平方向 居中对齐
UIControlContentHorizontalAlignmentCenter = 0,
//左对齐
UIControlContentHorizontalAlignmentLeft = 1,
//右对齐
UIControlContentHorizontalAlignmentRight = 2,
//
UIControlContentHorizontalAlignmentFill = 3,
};
哪些控件有这个属性??
继承自UIControl或者UIControl 本身,如下:
1/UITextField : UIControl <UITextInput, NSCoding, UIContentSizeCategoryAdjusting>
2/UIButton : UIControl <NSCoding>
*********************** 三 // contentMode **************
typedef NS_ENUM(NSInteger, UIViewContentMode) {
UIViewContentModeScaleToFill,
UIViewContentModeScaleAspectFit, // contents scaled to fit with fixed aspect. remainder is transparent
UIViewContentModeScaleAspectFill, // contents scaled to fill with fixed aspect. some portion of content may be clipped.
UIViewContentModeRedraw, // redraw on bounds change (calls -setNeedsDisplay)
UIViewContentModeCenter, // contents remain same size. positioned adjusted.
UIViewContentModeTop,
UIViewContentModeBottom,
UIViewContentModeLeft,
UIViewContentModeRight,
UIViewContentModeTopLeft,
UIViewContentModeTopRight,
UIViewContentModeBottomLeft,
UIViewContentModeBottomRight,
};
继承自 UIView : UIResponder
当多个约束出现的时候,按照一/二/三/就近原则,哪个约束就有效
原文:http://www.cnblogs.com/wzy1/p/6372872.html