ios - UITextView with emoticons editing -


i developing xmpp-client app. 1 of features sending smiles , user should have ability edit usuall text. emoticons editing in viber app best example of want implement.

i tried 3 ways solve problem:

  • i create emoticon usual uiimageview , place subview on uitextview using current caret rect. use 5 whitespaces text placeholder in text view. there 2 problems: placing emoticons on new line when inserting text in middle(printing whitespace not make caret move new line); when user placing caret using magnify glass, can move caret through emoticon(through 5 whitespaces), delegate method not called during process.
  • i have tried egotextview. there problems caret position , resizing when new line should added. , there rendering artifacts when using 1 line size.
  • i have tried using uiwebview. there great problems resizing based on text size , other artifacts speed of response when becoming first responder.

may 1 give me advice of working solution?

i'm not rects , ranges mechanism of uitextview/uitextinput, try give (untested) advice maybe achieve expected result.

built-in ios emojis simple characters, can follow same path building custom font (or extend existing one). have 2 options:

  • if want target ios 6.0 (that has native support nsattributedstring in uikit classes), try build custom font containing emoticons need, , use inside nsattributedstring (attributed string can mix different fonts, font sizes, styles , on).

  • you similar ios 5, since can't use nsattributedstring inside uitextview (so limited 1 font entire text) should use font combines actual characters , custom emoticons: should extend font want use typing, adding emoticons it. don't know if have licenses implications, anyway.

otherwise, go more low-level, implementing own custom textview using coretext, think hard work.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -