2013-02-02 1 views
1

UIButton을 가지고 있는데, imageView를 왼쪽으로 정렬하고 싶습니다. 시도했을 때 : self.cancelButton.imageView.contentMode = UIViewContentModeLeft;UIViewContentMode 대 UIControlContentHorizontalAlignment

여전히 센터 (UIViewContentModeCenter)에서 온다 이미지 뷰로

를 작동하지 않는 것

하지만 난 를 사용할 때 self.cancelButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;

이미지 뷰를 완벽하게 정렬합니다. UIViewContentModeLeft도 작동해야하는 이유는 무엇입니까?

답변

0

모든 UIControl 요소는 자녀 UIViews하고 UIImageViews의 contentMode을 대체 할 contentHorizontalAlignmentcontentVerticalAlignment 속성을 사용합니다. 명시 적으로 버튼의 contentHorizontalAlignment를 원하는 값으로 설정할 때까지 기본 contentHorizontalAlignment는 contentMode를 대체합니다.