kitensei kitensei - 1 year ago 79
iOS Question

Adding a custom view above the keyboard with Xamarin

I am trying to add a vustom view above the iphone keyboard to add custom actions for rich text editing (bold/colors/underlined etc..)

I've seen that ion Objective-C, there's a InputAccessoryView property to tweak but I haven't found any Xamarn samples, someone can help me with this ?

Furthermore, is it possible to edit the text with thoses controls ? e.g Select some text and make it colored, or select a color and then write with that color ?


Answer Source

As far as I know you just have to set the InputAccessoryView. Just take a UIView (I would take an UIToolbar) and it should be displayed when the Keyboard Appears. You have to set the Frame of the UIView on your own.

Example:How to add UIToolbar on top of UIKeyboard

For editing the text your can use a NSAttributedString instead of a String. Then you can set the AttributedText property by using you NSAttributedString instead of using the Text Property. You can also set colors for specific NSRanges in your NSAttributed String.