iOS:如何更改我的应用程序中alertView的每个文本,标题,按钮的每种字体?

时间:2019-01-04 09:34:58

标签: ios objective-c uialertview uiappearance

我已经植入了一个代码,该代码允许将我的应用程序的99%的字体转换为某些特定的字体:

@implementation UILabel(SizedFontName) //APPEARANCE
- (void)setSizedFontName:(id)test UI_APPEARANCE_SELECTOR
{
    NSString *fontName = self.font.fontName;
    CGFloat fontSize = self.font.pointSize;

    if ([[fontName lowercaseString] rangeOfString:@"bold"].location != NSNotFound || [[fontName lowercaseString] rangeOfString:@"fb"].location != NSNotFound)
    {
        self.font = [UIFont fontWithName:nameFontBold size:fontSize];
    }
    else if ([[fontName lowercaseString] rangeOfString:@"italic"].location != NSNotFound)
    {
        self.font = [UIFont fontWithName:nameFontItalic size:fontSize];
    }
    else
    {
        self.font = [UIFont fontWithName:nameFontRegular size:fontSize];
    }
}
@end

我用一行来称呼它:

//APPEARANCE
    [[UILabel appearance] setSizedFontName:nil];  

这很好用,但是我想用警报视图来完成我的应用程序,而该警报视图似乎逃脱了那段代码...

谢谢。

0 个答案:

没有答案