i want enable scrolling in textview if number of lines exceeds 5 otherwise there should not scrolling. possible , how achieve that?
uitextview inherits uiscrollview has property called scrollenabled
you can add register class uitextviewdelegate , implement method
- (void)textviewdidchange:(uitextview *)textview
then textview
object text
property, , check see how many newlines/carriage returns there are. if there more 5, set scrollenabled
yes
update:
take @ nsstring uikit additions, there methods in class allow cgsize
of nsstring
, sizewithfont:constrainedtosize:linebreakmode:
using should able enable scrolling once cgsize
reaches height equivalent or greater 5 lines of text calculated uifont.lineheight*5
Comments
Post a Comment