按鈕UIButton 上的image,title等content右對(duì)齊
- 使用方法
setContentHorizontalAlignment
[self.attentionBtn setContentHorizontalAlignment:UIControlContentHorizontalAlignmentRight];
self.attentionBtn.contentMode = UIViewContentModeRight;
self.attentionBtn.contentMode = UIViewContentModeTopRight;
self.attentionBtn.contentMode = UIViewContentModeBottomRight;
- 同樣使用方法
setContentVerticalAlignment
實(shí)現(xiàn)上下對(duì)齊
枚舉值:
typedef NS_ENUM(NSInteger, UIControlContentHorizontalAlignment) {
UIControlContentHorizontalAlignmentCenter = 0,
UIControlContentHorizontalAlignmentLeft = 1,
UIControlContentHorizontalAlignmentRight = 2,
UIControlContentHorizontalAlignmentFill = 3,
UIControlContentHorizontalAlignmentLeading API_AVAILABLE(ios(11.0), tvos(11.0)) = 4,
UIControlContentHorizontalAlignmentTrailing API_AVAILABLE(ios(11.0), tvos(11.0)) = 5,
};
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者