iOS系统字体大全,iOS系统中所有的字体

可以通过一个方法获取所有的字体:

// 获取系统所有的字体
    NSArray *TypefaceArray = [UIFont familyNames];

下面是我把字体全部复制了放入数组中,其他不多说,上实现内容:

//  TypefaceController.m
//
//  Created by user on 2016/11/3.
//  Copyright © 2016年 user. All rights reserved.
//

#import "TypefaceController.h"

@interface TypefaceController ()<UITableViewDelegate,UITableViewDataSource>

@end

@implementation TypefaceController
{
    NSArray *TypefaceArray;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor colorWithWhite:0.95 alpha:1.0];
    [self loadData];
    [self creatTableView];
}
- (void)loadData
{
    // 获取系统所有的字体
//    NSArray *TypefaceArray = [UIFont familyNames];
    TypefaceArray = @[@"Thonburi",@"Khmer Sangam MN",@"Kohinoor Telugu",@"Snell Roundhand",@"Academy Engraved LET",@"Marker Felt",@"Avenir",@"Geeza Pro",@"Arial Rounded MT Bold",@"Trebuchet MS",@"Arial",@"Menlo",@"Gurmukhi MN",@"Malayalam Sangam MN",@"Kannada Sangam MN",@"Bradley Hand",@"Bodoni 72 Oldstyle",@"Cochin",@"Sinhala Sangam MN",@"PingFang HK",@"Iowan Old Style",@"Kohinoor Bangla",@"Damascus",@"Farah",@"Papyrus",@"Verdana",@"Zapf Dingbats",@"Avenir Next Condensed",@"Courier",@"Hoefler Text",@"Euphemia UCAS",@"Helvetica",@"Lao Sangam MN",@"Hiragino Mincho ProN",@"Bodoni Ornaments",@"Apple Color Emoji",@"Mishafi",@"Optima",@"ujarati Sangam MN",@"Devanagari Sangam MN",@"PingFang SC",@"Savoye LET",@"Times New Roman",@"Kailasa",@"Telugu Sangam MN",@"Heiti SC",@"Apple SD Gothic Neo",@"Futura",@"Bodoni 72",@"Baskerville",@"Symbol",@"Heiti TC",@"Copperplate",@"Party LET",@"American Typewriter",@"Chalkboard SE",@"Avenir Next",@"Bangla Sangam MN",@"Noteworthy",@"Hiragino Sans",@"Zapfino",@"Tamil Sangam MN",@"Chalkduster",@"Arial Hebrew",@"Georgia",@"Helvetica Neue",@" Gill Sans",@"Kohinoor Devanagari",@"Palatino",@"Courier New",@"Oriya Sangam MN",@"Didot",@"PingFang TC",@"Bodoni 72 Smallcaps"];
}
- (void)creatTableView
{
    UITableView *tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)];
    tableView.delegate = self;
    tableView.dataSource = self;
    [self.view addSubview:tableView];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return TypefaceArray.count;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSString *cellID = @"cellID";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (!cell)
    {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    }
    cell.textLabel.text = [NSString stringWithFormat:@"字体样式12 %@", TypefaceArray[indexPath.row]];
    cell.textLabel.font = [UIFont fontWithName:TypefaceArray[indexPath.row] size:12];
    return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    NSLog(@"选中字体: %@",cell.textLabel.text);
}
运行的效果很明显:

  

       



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

启程Boy

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值