get a lineHeight in uitextview
i want to get a line height in uitextview, i have to use it for calculation in my app. i have use sizeWithFont:constrainedToSize:lineBreakMode:
method, but it gives the height of all lines in textview.
I have know about the Three20 library, but i dont know how to use it. Do somebody know how to do it??
is the Three20 library save to use? because i have read some article about rejecting app by Iphone开发者_如何学Go because using that library.
really need your help.. thank you every one
Regards,
-risma-
finnaly...
i've got my answer... thx for your answer Prasanna, i've so many idea using it, :) in this case, i dont use size from frame, but i use contentSize from textview, here the code i made :
NSString *head = [textView.text substringToIndex:textView.selectedRange.location];
//--get the size of this part--
CGSize initialSize = [head sizeWithFont:textView.font constrainedToSize:textView.contentSize];
NSUInteger startOfLine = [head length];
NSRange delimiter = [head rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:textView.text] options:NSBackwardsSearch range:NSMakeRange(0, startOfLine)];
//--substring the part after cursor position--
NSString *tail = [head substringFromIndex:delimiter.location];
//--gets the size of this part--
CGSize lineSize = [tail sizeWithFont:textView.font forWidth:textView.contentSize.width lineBreakMode:UILineBreakModeWordWrap];
it's done for me, maybe it can help you too, Prasanna
精彩评论