首页 > 其他分享 >IOS MoarFonts——字体定制:所见即所得

IOS MoarFonts——字体定制:所见即所得

时间:2022-12-27 18:40:22浏览次数:58  
标签:IOS Xcode fonts iOS Interface 所见即 MoarFonts your


MoarFonts

Use custom fonts for your iOS projects directly in Interface Builder, the WYSIWYG way

by Cédric Luthi “​​0xced​​”

About

Since iOS 3.2, you can use custom fonts in your iOS apps by adding the ​​UIAppFonts​​ Info.plist key. Unfortunately, custom fonts are not available when editing your xib files in Interface Builder. MoarFonts makes your custom fonts available right within Interface Builder.

MoarFonts is compatible with both Xcode 4 and Xcode 5.

 

 

If you are using MoarFonts in a team, you must purchase one license per user, including your continuous integration server if applicable.

Usage

In your project, add a ​​Run Script Build Phase​​​ with ​​/bin/bash -e​​ as shell and the following script:

mdfind -onlyin "${SRCROOT}" "kMDItemContentTypeTree == public.font" -0 | sort -z | xargs -0 /usr/local/bin/moarfonts install

This will make all fonts in your project directory available in Xcode. You will need to relaunch Xcode the first time you build your project.

Limitations

  • There is currently no demo nor trial version available.
  • MoarFonts will not work if you copy the iOS 6 SDK from Xcode 4 to Xcode 5. Note that this is not supported by Apple and that you should keep a copy of Xcode 4 anyway if you still plan to build with the iOS 6 SDK.

Testimonials

Screenshot

IOS MoarFonts——字体定制:所见即所得_xcode

Troubleshooting

  • Symptom: The custom fonts are not available in Interface Builder.
  • Solution #1: Make sure to quit and restart Xcode the the first time you build your project with the MoarFonts script phase.
  • Solution #2: If Spotlight is disabled the mdfind command will not find any font to install. In your script phase, replace mdfind -onlyin "${SRCROOT}" "kMDItemContentTypeTree == public.font" -0 with find "${SRCROOT}" -name "*.[ot]tf" -print0
  • Symptom: The following error occurs while running the MoarFonts script phase.

Failed to install Caviar Dreams: The file “Caviar Dreams.ttf” couldn’t be opened because there is no such file.

  • Solution #1: Install Xcode from the ​​dmg file​​ instead of from the Mac App Store.
  • Solution #2: In a terminal, type the following commands (adapt the SDKROOT environment variable if necessary) then build your project again. export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk /usr/local/bin/moarfonts reset

If you are still having issues with MoarFonts, please contact me by ​​e-mail​​ rather than twitter. Doing support in 140 characters is too hard.

标签:IOS,Xcode,fonts,iOS,Interface,所见即,MoarFonts,your
From: https://blog.51cto.com/u_3457306/5973144

相关文章

  • 在iOS 7中使用storyboard(part 1)
    Storyboard是一项令人兴奋的功能,在iOS5中首次推出,在开发app的界面时可以极大地节省时间。 如下图所示,这就是一个完整的应用的storyboard,接下来我们要学......
  • UITabBarController 标签栏控制器-IOS开发
    在UIKit中UITabbar代表了标签栏,而UITabBarController对其进行了封装,令多个不同的视图管理与切换变的更加轻松。构建一个标签栏控制器,首先要为每个按钮准备一个单独的页......
  • sqlite 实例教程 IOS下用sqlite打造词典-IOS开发
    sqlite是个好东西,对于移动平台来说。一直想写有关sqlite的教程,但是不知道从何写起,考虑了很久,还是从一个小Demo谈起吧。我写了一个精简版的词典,实现了增删查改的基本功能。......
  • iOS中登錄功能的體驗探究
    登錄功能是我在​​湖畔​​做的第一個需求。 當時PD给我的草圖和下圖類似:(圖片來自知乎iOS客戶端登錄界面) 不過需求中要求用戶名或者密碼錯誤時,輸入框要抖動(類似Mac登錄密......
  • IOS 6 自动布局 入门-1
    这篇文章还可以在这里找到 ​​英语​​​, ​​韩语​​​, ​​土耳其语​​​​​​来自Ray:恭喜各位!你们已经通过宣传​​iosfeast​​提前解锁了第一个有关IOS6的教......
  • iOS学习笔记45—本地通知UILocalNotification
    在iOS中有两类信息提示推送方式,一类是远程服务器推送(APNS),之前有笔记9​​,还有一类就是本地通知UILocalNotification,今天就简要的记录一下UILocalNotification的使用,代码里见......
  • iOS6下自定义UI控件外观效果
    尽管iOS原生的UI控件就已经有很不错的显示效果,但是App开发者仍然希望自己的产品与众不同,所以自定义UI外观成了每个App产品开发必做之事。今天就来做一个在iOS6下实现自定义U......
  • IOS中Json解析的四种方法
    作为一种轻量级的数据交换格式,json正在逐步取代xml,成为网络数据的通用格式。有的json代码格式比较混乱,可以使用此“http://www.bejson.com/”网站来进行JSON格式化校验(​​......
  • iOS多线程编程之NSThread的使用
    1、简介:1.1iOS有三种多线程编程的技术,分别是:1.、​​NSThread​​ 2、​​CocoaNSOperation​​ (​​iOS多线程编程之NSOperation和NSOperationQueue的使用​​)3、​​G......
  • iOS第三方开源库的吐槽和备忘
    做iOS开发总会接触到一些第三方库,这里整理一下,做一些吐槽。 目前比较活跃的社区仍旧是Github,除此以外也有一些不错的库散落在GoogleCode、SourceForg......