PDA

View Full Version : UITextView Word Wrap




ray648
Aug 23, 2010, 11:19 AM
I've got an ipad app with a UITextView containing a lot of text. The default is that word wrap is on, and lines are always broken between words. Is there any way of making this a bit less clever? I want it to just break lines at the point they reach the edge of the TextView, in the middle of a word if thats where it happens. Anyone know of a way to achieve this?



PhoneyDeveloper
Aug 23, 2010, 11:39 AM
Some of the UIKit views have a UILineBreakMode property, which you could set to UILineBreakModeCharacterWrap. As far as I can tell UITextView has no such property, including its base class and adopted protocols. I don't see any way to change the way it wraps text.

If your text is not editable then you could use a UILabel.

ray648
Aug 24, 2010, 04:13 AM
Thanks. Guess I'll have to find another way to do it.

robbieduncan
Aug 24, 2010, 05:10 AM
I suspect you might want to look at Core Text (http://developer.apple.com/iphone/library/documentation/Carbon/Reference/CoreText_Framework_Ref/index.html).