AVFonts
那是为了
AVFonts允许您使用应用程序中任何地方和任何地方的字体来执行任何您想做的事情。
你为什么要使用这个?
AVFonts可以轻松地交换系统字体或您使用的特定字体,并在整个应用程序中使用新字体。如果需要,您也可以增加或减小字体尺寸。现在,无需在接口构建器中选择自定义字体。通过简单地配置其大小和样式,然后将“系统字体”更改为“新字体”。很容易。
用法
1。 AVFonts AppDelegate 。
2。在didFinishLaunchingwithOptions中更改字体:
a)这将把从系统或CurrentFontName转换为应用程序中的NewFontname 。
AVFonts.changeFont(toFont: "Avenir-Heavy")
AVFonts .swapFont(currentFont: "Avenir-Light", toFont: "Avenir-Heavy")">
AVFonts .changeFont(toFont: " Avenir-Heavy " ) AVFonts .swapFont(currentFont: " Avenir-Light " , toFont: " Avenir-Heavy " )
b)在整个应用程序中提供的类型的字体交换/更改IE [.Button,.label,.textfield,.textView]。
AVFonts.changeFont(toFont: "Avenir-Heavy", [.button, .label])
AVFonts .swapFont(currentFont: "Avenir-Light", toFont: "Avenir-Heavy", [.button, .label])">
AVFonts .changeFont(toFont: " Avenir-Heavy " , [.button, .label]) AVFonts .swapFont(currentFont: " Avenir-Light " , toFont: " Avenir-Heavy " , [.button, .label])
c)增加/降低您的原始字体尺寸。
AVFonts.changeFont(toFont: "Avenir-Heavy", [.button,.label,.textfield], increment: 2)
AVFonts .changeFont(toFont: "Avenir-Heavy", [.button,.label,.textfield], increment: -2)
AVFonts .swapFont(currentFont: "Avenir-Light", toFont: "Avenir-Heavy", [.button, .label, .textfield], increment: 2)
AVFonts .swapFont(currentFont: "Avenir-Light", toFont: "Avenir-Heavy", [.button, .label, .textfield, .textview], increment: -2)
">
AVFonts .changeFont(toFont: " Avenir-Heavy " , [.button,.label,.textfield], increment: 2) AVFonts .changeFont(toFont: " Avenir-Heavy " , [.button,.label,.textfield], increment: -2) AVFonts .swapFont(currentFont: " Avenir-Light " , toFont: " Avenir-Heavy " , [.button, .label, .textfield], increment: 2) AVFonts .swapFont(currentFont: " Avenir-Light " , toFont: " Avenir-Heavy " , [.button, .label, .textfield, .textview], increment: -2)
3。调用AVFonts .apply AVFonts ()应用所有更改。
例子
要运行示例项目,请首先从示例目录中pod install 。
要求
- iOS 8.0+ / macOS 10.10+ / tvos 9.0+ / watchOS 2.0+
- XCode 10.2
- Swift 5.0
安装
可可录
Cocoapods是可可项目的依赖性经理。您可以使用以下命令安装它:
$ gem install cocoapods构建AVFonts需要Cocoapods 1.1.0+。
要使用Cocoapods将AVFonts集成到您的Xcode项目中,请在您的Podfile中指定:
AVFonts"
end">
source 'https://*gith*ub*.com/CocoaPods/Specs.git' platform :ios , '10.0' use_frameworks! target '<Your Target Name>' do pod " AVFonts " end
然后运行以下命令:
$ pod install作者
Arnav Gupta,arnavgupta180@gmail.com
执照
AVFonts可根据MIT许可获得。有关更多信息,请参见许可证文件。
下载源码
通过命令行克隆项目:
git clone https://github.com/arnavgupta180/AVFonts.git