UIImageView의 경우 UIViewContentMode를 interface builder(IB)에서 조절할 수 있다.
(Scale to fit, Aspect fit, Aspect fill, ...)
하지만, UIButton에 이미지를 적용했을 경우 IB에서는 버튼 view 자체의 UIViewContentMode만 변경할 수 있는데, 코드로 다음과 같이 변경하면 된다.
UIButton *button = [[UIButton ...]];
[button.imageView setContentMode:UIViewContentModeScaleAspectFit]
위의 예제는 버튼의 이미지 모드를 Aspect fit으로 변경한 경우이다.
'iPhone dev.' 카테고리의 다른 글
UIImage 방향 바꾸기 (0) | 2013.01.10 |
---|---|
아이폰 빈 공간(사용량) 구하기 (0) | 2012.12.01 |
아이폰 3GS/4/4S와 5 화면 구분하기 (0) | 2012.11.15 |
아이콘 이름 localization (0) | 2012.09.26 |
iTunes 혹은 appstore로 앱 링크 걸기 (0) | 2012.08.20 |