Sending images using the iOS 8 custom keyboard?

I am developing a custom keyboard for iOS 8, but came across a problem trying to send images from the keyboard. I did some research, and there seems to be no easy way to do this using UITextDocumentProxy , because only NSStrings allowed.

Can I ignore any simple ways to use a custom keyboard to send images and / or is there a way around this problem?

Thanks in advance

+7
ios objective-c ios8 swift keyboard
source share
1 answer

Apparently, you are not the only person who can try such a keyboard . If you look at the animated GIF on the site, the keyboard uses copy / paste to add the image to the messages.

The UIKeyInput Protocol , which is inherited by UITextDocumentProxy , has the following function:

 func insertText(_ text: String) //Swift - (void)insertText:(NSString *)text //ObjC 

They accept only String or NSString, as you already know. Since there are no other ways to insert content, we can assume that there is currently no other way.

Now I suggest you use a similar use. When a user clicks on an image, add it to UIPboardboard. Perhaps imagine a small banner on the keyboard that says “Now you can paste” or something like that, but it is up to you to decide.

+9
source share

All Articles