2013-02-20 3 views
-2

UIAppearance을 사용하여 내 응용 프로그램의 UIButtons 글꼴 크기를 15로 설정하고 글꼴 크기를 내 응용 프로그램의 UILabels에 10으로 설정하고 싶습니다. 여기 있습니다 내가 무엇을 :별도의 UI 요소에 UIAppearance 사용

UIFont *smallerFont =[UIFont fontWithName:@"DINPro-Medium" size:15]; 
[[UILabel appearanceWhenContainedIn:[UIButton class], [UINavigationBar class], nil] setFont:smallerFont]; 

을하지만 폰트가 기본으로 머물고있다 .. :

UIFont *dinMediumFont = [UIFont fontWithName:@"DINPro-Medium" size:15]; 
[[UILabel appearanceWhenContainedIn:[UIButton class], nil] setFont:dinMediumFont]; 

UIFont *dinBoldFontBig = [UIFont fontWithName:@"DINPro-Bold" size:10]; 
[[UILabel appearanceWhenContainedIn:nil] setFont:dinBoldFontBig]; 

그러나, 나는 작게 UINavigationBars의 버튼의 글꼴을하고 싶습니다,이 추가 시도 왜 그럴 수 있니?

+1

무엇이 질문입니까? 지금까지 진술을하고 몇 가지 코드를 게시했습니다. – rmaddy

+0

죄송합니다, 방금 편집했습니다. – Eric

답변

0

탐색 모음의 버튼은 UIButton이나 해당 하위 클래스의 인스턴스가 아닙니다. 대신 그들은 UIBarButtonItem의 인스턴스입니다.

UIBarButtonItem의 텍스트는 실제로 UILabel 인스턴스가 아닌 : 대신 UILabel의 속성 설정의 '의 등장 - 인 - UIButton 프록시를, 두 번째 조각은 UIBarButtonItem의 모습 프록시에 font 속성을 설정해야합니다.