iOS 8 Custom Keyboard -
iOS 8 Custom Keyboard -
i trying build custom keyboard, it's emoji keyboard, keyboard's info json file. after parse json file , data, how create custom keyboard utilize , show in keyboard view, emoji keyboard built in? right now, follow app extension keyboard: custom keyboard guide, , there little bits of info here. there tutorial or guide how create custom emoji keyboard online? current codes trying below:
class keyboardviewcontroller: uiinputviewcontroller { override func viewdidload() { super.viewdidload() var error: nserror? allow yanfile = nsbundle.mainbundle().pathforresource("yan", oftype: "json") allow yandata = nsdata(contentsoffile: yanfile) nsdata allow yandict = nsjsonserialization.jsonobjectwithdata(yandata, options: nsjsonreadingoptions.mutablecontainers, error: &error) nsdictionary println("dict: \(yandict)") //print nil in console // perform custom ui setup here self.nextkeyboardbutton = uibutton.buttonwithtype(.system) uibutton self.nextkeyboardbutton.settitle(nslocalizedstring("next keyboard", comment: "title 'next keyboard' button"), forstate: .normal) } } the json below:
{ "list": [ { "tag": "laugh", "yan": [ "o(*≧▽≦)ツ┏━┓", "(/≥▽≤/)", "ヾ(o◕∀◕)ノ" ] }, { "tag": "wanna", "yan": [ "✪ω✪", "╰(*°▽°*)╯", "≖‿≖✧", ">ㅂ<", "ˋ▽ˊ", "✪ε✪", "✪υ✪", "ヾ (o ° ω ° o ) ノ゙", "(。◕ˇ∀ˇ◕)", "(¯﹃¯)" ] } ] }
you can build xib file clicking new file -> view
1) within xib file create uiview 320x216 , can drag'n'drop whatever controls want it
2) can load nib keyboard's inputview:
// perform custom ui setup here uiview *layout = [[[nsbundle mainbundle] loadnibnamed:@"keyboardxib" owner:self options:nil] objectatindex:0]; [self.inputview addsubview:layout]; 3) think it's amazing if build json keyboard api send json of keyboard map app , app knows how arrange keys on inputview accordingly
let know if build project!
edit:
4) of need parse json , display content want json uibuttons, , decide text inserting text field
check out question: how parse json file in swift?
good luck!
ios keyboard swift ios8 ios-app-extension
Comments
Post a Comment