simple text editor for iPhone - iphone

Is there any simple text editor available for iphone having features like BOLD, ITALIC and changing colors and fonts? I want to add this functionality to my iphone app.
Any help will be really appreciated.

You have to develop it through Quartz2d.In otherwords ,you can through handling CGContext of UIView. see the Quartz2d programming guide.for example you can give bold font through
CGContextSelectFont (context,"Helvetica-Bold",12, kCGEncodingMacRoman);

Text Editor Pro seems to have those features. Pretty expensive though: http://itunes.apple.com/dk/app/text-editor-pro/id316815447?mt=8

Oliver Drobnik (aka Cocoanetics) is working on a rich text editor for iOS.
It won't be free, unfortunately. However, he has released a sizeable chunk of code that serves as the foundation of his rich editor here: https://github.com/Cocoanetics/NSAttributedString-Additions-for-HTML
It takes HTML and turns it into core text. A lot of hard work right there.
That, on its own, is not a rich editor, but like I said, it serves as the foundation of one. You could use it to write your own, if you don't want to pay up for Oliver's when he's finished. You can see what Oliver has been working on here: http://www.cocoanetics.com/2011/01/rich-text-editing-on-ios/

Related

Double header on iphone

I have come across a weird double header/h1 tag on the iPhone 4. If you view the my site on an iPhone the header is rendered twice, but overlaying each other slightly, if you zoom in on the header, it becomes one, like a normal heading on any website.
Has anyone else encountered this and know a solution? I've been at it for weeks can't find anything like it online.
Here is my site: http://cafe.cic.hull.ac.uk/~405851/
Thanks for any help.
Your problem seems similar to the one discussed and answered here: iOS 4.2+ webfont (ttf) 's bold font-weight rendering bug
Apparently one solution is to to change the inherited style via a font-weight:normal styling. This doesn't solve your issue if you feel that the text needs to be bold of course. You could try using different font weights as well.
Custom font rendering has had funky bugs in iOS for a while. In the iOS3 days, I was able to crash webkit itself with custom fonts. Good times.
So I would recommend using something like http://www.google.com/webfonts instead. The font files they serve are guaranteed to work well cross platform, and the stylesheet to include the fonts is tailored to the quirks of platform that requests it. They do a good job at avoiding font rendering bugs and cross platform inconsistencies.
For that reason, I would use Google WebFonts to serve any custom fonts if I had web content that needed to be shown consistently cross platform.
The tradeoff is that you don't get as much selection of fonts. But they do have a good amount, just not every font.

Rich Text View like Instagram Comment

I would like to implement rich format text views as are demonstrated in Instagram. Following is a screenshot.
Specifically, my goals are:
Words at different positions of the same text view may have different font sizes, font colors and font styles(bold, italic, etc).
Touch events (long press, touch down, etc) can be detected in the delegate callbacks. Information (which word is touched, whether it's a long press or a touch down, etc) can be gathered in such callback methods.
Big frameworks like Three20 are out of the question. Small, independent libraries are highly preferred. Low level Cocoa Touch APIs may also be OK if it won't take me more than a few days to wrap them up.
Any suggestions are highly appreciated.
NSAttributedString lets you do this. If you have access to the iOS 5 developers cookbook by Erica Sadun there is a recipe for a wrapper around NSMutableAttributedString which makes it simple to add text piece by piece, changing attributes as you go.
Here is the source on Erica's githuib
Finally found an ideal open source solution (supports both iOS 5.0 and iOS 6): the OHAttributedLabel, which is capable of both rich format and touch handling.
https://github.com/AliSoftware/OHAttributedLabel

Text Editor like Pages iPad App

I want to implement a functionality similar to found in Pages app..i.e. text floating around images, image zooming etc.. I have been struggling with this part of my application but no success yet. Would be grateful if someone provides me with some pointers in this regard , like 'Which UIControl should I use?','Help in thinking logic' etc..
Thanx in advance.
Sounds like a fun app to develop.
Some Pointers:
Immediately off the bat, I would say look into creating your own Controls for the floating objects.
I would suggest tackling a smaller project, or maybe a few small to medium size projects. p
Try making a few apps with WinForms or WPF. Also look into XSL:FO.
Immediately off the bat, I would say look into creating your own Controls.
There was a WWDC session that talked about iOS text. I don't think it's violating NDA to say this is going to be a very hard project. No, make that very, very, very hard.
You will probably need to do all UI yourself, and use Core Text for rendering of the text. (But I believe you need to draw selection, etc.) And do the layout yourself.

iPhone Unicode Text with CoreGraphics

I'm using CGContextShowGlyphsAtPoint in my application to render characters that follow a path. I'd had no problems with this at all until I started on i18n of the application and found that Japanese characters appear fine everywhere apart from when I try to render them using this function.
Is there a way to have these characters appear properly, as opposed to being rendered as empty boxes? Stupidly, I didn't see this coming (newbie iPhone developer) and I really need to support these characters :(
I've been searching stackoverflow and google all day but seem to be getting nowhere with this.
Thanks for any help you can offer,
Bryn
This is a very similar question to your own. Basically, it is very difficult to get the appropriate glyphs for doing pure Quartz drawing of text, so I recommend using the NSString UIKit category method -drawAtPoint:withFont:. This will get you all the support that NSString has for languages, while letting you draw directly to a Core Graphics context. It's what we use in the Core Plot framework for text rendering within a CALayer.
However, drawing this way is much slower than pure Quartz text rendering, so if you're doing a lot of text drawing it could slow things down in your application. Also, the UIKit extensions to NSString take into account the flipped graphics context of UIViews and their CALayers, which has caused others problems.
I did not know this, but I did some digging and I'll tell you what I found:
The Quartz2D Programming Guide refers to the "ATSUI Programming Guide" but has no active link.
Google turned up a cached copy of the legacy ATSUI Carbon API here
Apple states here that you should not use ATSUI, but instead use CoreText
There is an open radar to port CoreText to iPhone since 31-Jul-2009 12:54 PM
Sorry mate :(

CFAttributedString on the iPhone

Is it possible to use the CFAttributedString type to draw formatted text on the iPhone? I see it in the documentation, but I can't figure out how to actually draw it to a context.
Three20 has a formatted text field. Basically Joe Hewitt implemented a light HTML interpreter to render the text, so it is much faster than a webview. fast enough to be used in a tableview.
The workaround is to use a WebKitView. Format your text as HTML and display in a mini web view at whatever size you need.
Actually, it turns out this is answered in the iPhone documentation, I just didn't read it carefully enough:
iPhone OS Note: While Core Foundation on iPhone OS contains CFAttributedString, there are no additions to the APIs in UIKit to add specific attributes such as font, style, or color, and there are no APIs to draw attributed strings.
There you go, no free formatted text. Bummer.
Kyle
There's an undocumented method on TextView to pass in HTML formatted text (it's really a kind of web view underneath). A number of apps in the store make use of it, just make sure your app works without it there.