iPhone SDK 3.2 and UIAppFonts

前端 未结 3 741
栀梦
栀梦 2020-12-15 12:06

I\'ve added my custom font to UIAppFonts and it\'s loaded just fine: (shows up in [UIFont familyNames] ). When I manually set the font in viewDidLoad { [m

3条回答
  •  -上瘾入骨i
    2020-12-15 12:31

    If you don't want to have to subclass, this solution worked quick and dirty for me. Of course it assumes that all labels have the same font, and in my case that was the case.

    for (UIView *v in view.subviews) {
    
        if ([v isKindOfClass:[UILabel class]]) {
          UILabel *label = (UILabel*)v;
    
          [label setFont:[UIFont fontWithName:@"Quake" size:label.font.pointSize]];
        }
    }
    

    I put this in a helper class and just called it, passing in my current view.

提交回复
热议问题