Is it possible to get the first line of text fr开发者_JS百科om a UITextView. I have looked through the UITextView and NSString Class References and can't find any methods that could accomplish this.
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.
精彩评论