zoukankan      html  css  js  c++  java
  • [Xcode 实际操作]九、实用进阶-(2)遍历设备(输出系统)上的所有字体

    目录:[Swift]Xcode实际操作

    在实际工作中,经常需要调整界面元素的字体种类。

    本文将演示输出系统提供的所有字体,方便检索和使用。

    在项目导航区,打开视图控制器的代码文件【ViewController.swift】

     1 import UIKit
     2 
     3 class ViewController: UIViewController {
     4 
     5     override func viewDidLoad() {
     6         super.viewDidLoad()
     7         // Do any additional setup after loading the view, typically from a nib.
     8         
     9         //首先对设备中所有的字体进行遍历操作
    10         for familyName in UIFont.familyNames
    11         {
    12             //在控制台打印输出字体组信息
    13             print("
    [(familyName)]")
    14             //查找并遍历,字体组中的所有字体的名称
    15             for font in UIFont.fontNames(forFamilyName: familyName)
    16             {
    17                 //并在控制台打印输出字体的名称
    18                 print("	(font)")
    19             }
    20         }
    21     }
    22 
    23     override func didReceiveMemoryWarning() {
    24         super.didReceiveMemoryWarning()
    25         // Dispose of any resources that can be recreated.
    26     }
    27 }
  • 相关阅读:
    Python-os
    Python-字典Dict
    Linux下使用Apache搭建Web网站服务器
    Linux中FTP安装与配置
    第16章 广域网
    第15章 IPv6
    第14章 思科无线技术
    第13章 网络地址转换NAT
    第12章 安全
    第11章 虚拟局域网
  • 原文地址:https://www.cnblogs.com/strengthen/p/10085081.html
Copyright © 2011-2022 走看看