I've heard of some success with integrating this into a UIWebView in iOS 5. If you have access to the Apple iOS dev center, the WWDC session Rich Text Editing in Safari on iOS talks all about this approach.Ī variation of this approach is to use a third-party rich text editor like TinyMCE. So you can easily retrieve the edited text as HTML using [myWebView You can also add custom context menu items like you show in the screen shot in your question. You will also want to add a Javascript function to your HTML template file like this: function getHtmlContent() See the Mozilla documentation on contentEditable for a great reference. This is done with a set of simple javascript function calls. The next step is to add rich text formatting functionality. At this point, you should be able to run your app tap on the text, and be presented with a cursor and be able to add/remove text. Now you have a UIWebView displaying your text inside a div with contentEditable. Send the loadHTMLString:baseURL: message to the UIWebView with that HTML string. Load the contents of this file into an NSMutableString and replace the TEXT_PLACEHOLDER string with the text you want to edit.Ģ. The bare minimum that it needs is this:ġ. The basic idea is to load a custom HTML document from your app resources directory. Use a UIWebView (instead of a UITextView) and the contentEditable HTML attribute. I don't have any experience with this approach. I know of two fundamental approaches to creating a rich text editor in iOS 5:
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |