views:

292

answers:

1

Is it possible to get the first line of text from a UITextView. I have looked through the UITextView and NSString Class References and can't find any methods that could accomplish this.

A: 

The only way to accomplish this is through a process of iteration using the multi line text methods detailed in "NSString UIKit Additions Reference". Extract the first few words from your string and start compositing these gradually until the " sizeWithFont:constrainedToSize:lineBreakMode:" returns a size which height is higher than that of a line with just 1 word.

Run Loop
Thanks I'll give that a try
John