2017-12-14 14 views
0

그래서 최근에 iOS 11과 호환되도록 앱을 조작하기 시작했습니다. 고맙게도 그것의 대부분이있는 것 같습니다.글꼴 아이콘을 두드 리거나 낄 때 물음표

그러나 툴바에서 fontello의 ttf 파일에서 제공하는 아이콘을 탭하거나 누른 채로 있으면 툴바에 물음표 상자가 나타납니다. 아이콘의

예 :

menu = [[UIBarButtonItem alloc] initWithTitle:@"\ue811" style:UIBarButtonItemStylePlain target:self action:@selector(openMenu:)]; 
    [menu setTitleTextAttributes:@{NSFontAttributeName: 
             [UIFont fontWithName:@"fontello" 
                 size:23], 
            NSForegroundColorAttributeName:[[UIColor alloc] initWithWhite:1.f alpha:1.f]} 
         forState:UIControlStateNormal]; 

그것은 10.3.1 시뮬레이터에서 잘 작동합니다. iOS 11만으로 끝나는 것 같습니다. 나는 OS를 업데이트하는 것을 의미하는 장치에 대한 수정을 읽었지만, 시뮬레이터는 11.2를 실행 중이므로 이론적으로 수정해야한다.

다른 사람이이 문제가 있습니까? 고침을 알고 있니?

답변

1

그냥 을 UIControlStateSelected에 대한 제목 텍스트 속성을 추가

[menu setTitleTextAttributes:@{NSFontAttributeName: 
            [UIFont fontWithName:@"fontello" 
                size:23], 
           NSForegroundColorAttributeName:[UIColor greenColor]} 

forState : UIControlStateSelected]

+0

당신이 대답 할 때 나는 내 연구 결과를 쓰고 있었고, 당신도 맞습니다. 어쨌든, iOS 1에서는 정상적인 설정과 선택/강조 표시가 필요합니다. 내가 선택한 것을 선택할 때 경고를 받았기 때문에 강조 표시해야했습니다. – ChrisOSX

0

의견에서 언급했듯이 iOS 11에서는 정상 상태 및 선택/강조 표시 상태에 대한 설정이 필요합니다. 아래는 나를 위해 일하는 것입니다. 많은 버튼에 따라 추가 코드를 작성하는 것이 이상적이지는 않지만 오히려 좋습니다.

[menu setTitleTextAttributes:@{NSFontAttributeName:[UIFont fontWithName:@"fontello"size:23], 
            NSForegroundColorAttributeName:[[UIColor alloc] initWithWhite:0.f alpha:1.f]} 
         forState:UIControlStateNormal]; 
    [menu setTitleTextAttributes:@{NSFontAttributeName:[UIFont fontWithName:@"fontello"size:23], 
            NSForegroundColorAttributeName:[[UIColor alloc] initWithWhite:0.f alpha:0.5f]} 
         forState:UIControlStateHighlighted];