iOS字型列印

有稜角的圓發表於2016-05-19

//列印所以字型
    NSArray *familyNames = [UIFont familyNames];
    for(NSString *familyName in familyNames)
    {
        NSLog(@"%@", familyName);
        NSArray *fontNames = [UIFont fontNamesForFamilyName:familyName];
        for(NSString *fontName in fontNames)
        {
            NSLog(@"\t%@", fontName);
        }
    }

//設定字型
    //設定font
    UIFont *font1=[UIFont fontWithName:@"Heiti TC" size:20];
    UILabel *label1=[[UILabel alloc]initWithFrame:CGRectMake(100, 150, 100, 30)];
    label1.text=@"你好";
    label1.font=font1;
    [self.view addSubview:label1];

相關文章