4
我想在FontAwesome Swift library中使用一些圖標作爲UITabBarItem圖像。我已經能夠設置UITabBarItem標題,但我無法設置UITabBarItem圖像。我的代碼如下:Swift:使用FontAwesome圖標作爲UITabBarItem圖像
class AEVTabBarController: UITabBarController {
var itemLabels = ["Promos", "Marcas", "Amigos", "Cerca de mí", "Más"]
override func viewDidLoad() {
super.viewDidLoad()
let tabItems = self.tabBar.items as [UITabBarItem]!
for index in 0..<itemLabels.count {
let currentItem = tabItems[index] as UITabBarItem
currentItem.title = itemLabels[index]
currentItem.image = String.fontAwesomeIconWithName(FontAwesome.Money) as UIImage
}
}
}
編譯器告訴我的是'String'不能轉換爲'UIImage'。有沒有辦法將一個字符串轉換爲UIImage還是有另一種方法來解決這個問題?
在此先感謝。
謝謝,我想我應該讀一點這個庫。 – lmiguelvargasf
他們有不錯的文檔!應該幫助很多希望。 –