/// Ccuitextview. M // ccfc // created by Xichen on 11-12-22. // copyright 2011 ccteam. all rights reserved. // # import "ccuitextview. H "# import" ccuiview. H "# import" cclog. H "@ implementation uitextview (CC) + (uitextview *) createcommontextview :( cgrect) rect withtext :( nsstring *) text {uitextview * textview = [[uitextview alloc] Reverse: rect]; textview. backgroundcolor = [uicolor whitecolor]; textview. textcolor = [uicolor blackcolor]; textview. TEXT = text; textview. editable = no; return [textview autorelease];} // get the row count of a textview's text // nearly OK-(INT) gettextrows {cgsize size = [self. text sizewithfont: Self. font constrainedtosize: cgsizemake (self. width, uint_max) linebreakmode: uilinebreakmodewordwrap]; log_size (size); cgsize tempsize = [self. text sizewithfont: Self. font]; log_size (tempsize); Return (INT) Ceil (size. height/tempsize. height);} @ end
There may be updates:
Googlecode link: http://code.google.com/p/iphone-common-codes-ccteam/source/browse/trunk/CCFC/files/CCUITextView.m
GitHub address:
Https://github.com/cxsjabc/iphone-common-codes-ccteam/tree/master/CCFC/files/CCUITextView.m