一個(gè)簡(jiǎn)單的小技巧,使的文字能夠居上:
只要繼承 UILabe,然后重寫 drawTextInRect方法,如下:
- (void)drawTextInRect:(CGRect)rect {
CGRect actualRect = [self textRectForBounds:rect
limitedToNumberOfLines:self.numberOfLines];
[super drawTextInRect:actualRect];
}
使用的時(shí)候只需要正常使用就好了~ (?????????)