How the UILabel
can be aligned from bottom. Let say, my label can hold three line of text.If the input text is single line, then this line should come bottom of the
Subclass UILabel
@interface Label : UILabel
@end
Then override drawTextInRect like so
@implementation Label
- (void)drawTextInRect:(CGRect)rect
{
if(alignment == top) {
rect.size.height = [self sizeThatFits:rect.size].height;
}
if(alignment == bottom) {
CGFloat height = [self sizeThatFits:rect.size].height;
rect.origin.y += rect.size.height - height;
rect.size.height = height;
}
[super drawTextInRect:rect];
}
@end