有些时候UILabel设置的frame偏大,里面的文字又不足以撑满,我们能通过textAlignment控制水平方向的对齐方式,但这个时候UILabel在竖直方向上也是居中对齐的,重写drawTextInRect就可以让文字居上
//让文字居上
- (void)drawTextInRect:(CGRect)rect {
CGRect actualRect = [self textRectForBounds:rect
limitedToNumberOfLines:self.numberOfLines];
[super drawTextInRect:actualRect];
}