As promised I have gone through all the tutorials including the bonus code and some of the requests in the comments to put together a Xcode Project of the Rich Text Editing series.
If you haven’t already, check out the iOS5 Rich Text Editing Series.
The features of the project include:
- Bold, Italics and Underlining
- Highlighting (via UIMenuController)
- Font Size adjustment
- Font Color adjustment
- Font adjustment
- Undo and Redo
- Image insertion
- Draggable images
- Auto updating bar items which display the current state
- Bonus Code Hiding keyboard accessory view
- Bonus Code Hiding all other items in UIMenuController





Thanks for the example project.
Just wondering though, why are there so many warnings?
@Freerunnering There are 6 warnings, the majority of which are because I have assigned the main view controller as a delegate without saying it conforms to the protocol in the header file.
One is because of giving a UINavigationController to a property which specifies it be a RichTextEditorViewController, this is easily fixed by changing the property definition.
Another is that a method is called before it is defined in RichTextEditorViewController.m this can be fixed by putting a method definition in the header file.
After all of those there is only one, which is that the compiler doesn’t think that UIGestureRecognizer will respond to canBePreventedByGestureRecognizer: even though it is defined in the documentation. I’m not sure why the compiler flags this as a warning so if anyone can shed any light on that then be my guest.
Anyway, so that everyone is happy I updated the project (and download link) so that it only has one warning (the one stated directly above).
thanks a lot for such a fantastic tutorial & project files. I love to implement it asap & hope i’ll learn a lot in this implementation process.
When I click on the download link it goes to another page but no project to download. Any help is appreciated.
@Developer That download link doesn’t seem to be working at the current time. I’ve added a mirror for now.
Thank you, the mirror link worked. Thank you so much for sharing this project, it is appreciated by all of us.
Is there a way to export the HTML part to PDF?
@Developer I’m not sure exactly how you would export the HTML to PDF but I suggest you do a bit of google searching and have a look on Stack Overflow. I’ve found a couple such as:
Convert html file to PDF Document in iOS using Cocoa-Touch
Get a PDF/PNG as output from a UIWebView or UIView
Hope that helps!
Any plans to show us how to add Auto-Correction – where a suspected misspelled word has a red dotted underline
Have you figured out how to focus UIWebView through becomeFirstResponder or something else?
@Frank Unfortunately it is not possible. See this post here on stack overflow for an answer as to why: http://stackoverflow.com/q/7332160/92714
This is a fantastic tutorial and sample. I was wondering if you have figured out a way to enable autocorrect. I have tried a bunch of things but I could not get it going. Thanks!
not support ios 4.x.. T_T
html5 contenteditable don’t use…
how use.. ios4.x version…?
@kofktu Unfortunately the contentEditable attribute on div’s has only become possible to use in iOS 5, so is not available on any older versions. For versions less than iOS 5 the only real option is Core Text.
@Mike I haven’t figured it out myself, but I have found this answer on stack overflow. It suggests setting the value of the autocorrect and autocomplete attributes however the comments suggest that this hasn’t worked. It also suggests that it is only possible to set these attributes for input tags, so I am not too sure. Sorry!
very nice link…..but i want to rotate the text and images is there any solution
@Jaspreet It is possible to rotate a div using javascript, here is the javascript that has worked for me:
targetDiv.style.webkitTransform = 'rotate(180deg)';