如何在 swift 中使用字体真棒图标?

Ans*_*bal 5 icons svg glyphicons swift

我使用此代码,但没有显示图标,它显示我是这样的

i.stack.imgur.com/hPEPs.png

medicalpacakgesbutton.setTitle("\u{f0c3}", for: .normal)
Run Code Online (Sandbox Code Playgroud)

sun*_*nce 9

在您的应用程序中使用 Font Awesome 的最佳方法是FontAwesome.Swift

按钮图标示例:

button.titleLabel?.font = UIFont.fontAwesome(ofSize: 30)
button.setTitle(String.fontAwesomeIcon(name: .coffee), for: .normal)
Run Code Online (Sandbox Code Playgroud)

或者对于标签栏图标:

let image = UIImage.fontAwesomeIcon(name: .coffee, textColor: UIColor.black, size: CGSize(width: 40, height: 40))
viewController.tabBarItem = UITabBarItem(title: "Coffee", image: image, tag: 1)
Run Code Online (Sandbox Code Playgroud)