You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
752 B
20 lines
752 B
#import "RNSVGTopAlignedLabel.h"
|
|
|
|
@implementation RNSVGTopAlignedLabel
|
|
|
|
- (void)drawTextInRect:(CGRect)rect
|
|
{
|
|
NSAttributedString *attributedText = [[NSAttributedString alloc] initWithString:self.text
|
|
attributes:@{NSFontAttributeName : self.font}];
|
|
rect.size.height = [attributedText boundingRectWithSize:rect.size
|
|
options:NSStringDrawingUsesLineFragmentOrigin
|
|
context:nil]
|
|
.size.height;
|
|
if (self.numberOfLines != 0) {
|
|
rect.size.height = MIN(rect.size.height, self.numberOfLines * self.font.lineHeight);
|
|
}
|
|
[super drawTextInRect:rect];
|
|
}
|
|
|
|
@end
|