Thursday, 15 July 2010

ios8 - Error when connecting button in Swift Custom Keyboard -



ios8 - Error when connecting button in Swift Custom Keyboard -

i'm creating custom keyboard extension written in swift. i'm trying design keyboard visually using nib (.xib) file. i'm getting error when trying connect button.

i found nib (keyboardview) wouldn't show unless explicitly added in keyboardviewcontroller's viewdidload() method:

self.view.addsubview(uinib(nibname: "keyboardview", bundle: nil).instantiatewithowner(nil, options: nil)[0] uiview)

i connected button nib generated this:

@iboutlet weak var nextkeyboardbutton: uibutton!

when test keyboard next error: 'this class not key value coding-compliant key nextkeyboardbutton.'

if remove connection, error disappears , keyboard shows correctly. i'm using built-in custom keyboard template , haven't added code besides adding subview above , single button in nib.

found problem, had specify owner (self) when loading nib:

self.view.addsubview(uinib(nibname: "keyboardview", bundle: nil).instantiatewithowner(self, options: nil)[0] uiview)

swift ios8 custom-keyboard

No comments:

Post a Comment