Created
March 20, 2013 20:16
-
-
Save romyilano/5208055 to your computer and use it in GitHub Desktop.
Matt Neuberg - how to make text adjust in a UILabel - Programming iOS 5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // thank you matt neuberg!!! | |
| -(CGRect)textRectForBounds:(CGRect)bounds | |
| limitedToNumberOfLines:(NSInteger)numberOfLines { | |
| CGSize sz = [self.text sizeWithFont:self.font | |
| constrainedToSize:CGSizeMake(self.bounds.size.width, 10000) | |
| lineBreakMode:self.lineBreakMode]; | |
| return (CGRect) {bounds.origin, CGSizeMake(self.bounds.size.width, sz.height)]; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment