33.读取bundle文件
作者:
noonez | 来源:发表于
2016-07-12 16:55 被阅读57次

Paste_Image.png
/**
读取表情列表
*/
func readFaceList() {
let bundle = NSBundle.mainBundle().pathForResource("Emoji", ofType: "bundle")
let path = NSBundle(path: bundle!)?.pathForResource("emoji", ofType: "plist")
let data = NSArray(contentsOfFile: path!)
for item in data! {
let dic = item as? NSDictionary
let chatName = dic?.valueForKey("cht") as? String
let image = dic?.valueForKey("png") as? String
let imagePath = NSBundle(path: bundle!)?.pathForResource(image, ofType: nil)
let type = dic?.valueForKey("type") as? String
let emojiType = EmojiType(rawValue: type!)
let emoji = EmojiData(chat: chatName!, image: imagePath!, type: emojiType!)
emojiList.append(emoji)
}
}
本文标题:33.读取bundle文件
本文链接:https://www.haomeiwen.com/subject/hbcsjttx.html
网友评论