UILabel+YOHO.m 564 Bytes
//
//  UILabel+YOHO.m
//  YH_Mall
//
//  Created by Haizi on 16/2/23.
//  Copyright © 2016年 YOHO. All rights reserved.
//

#import "UILabel+YOHO.h"
#import "UIView+YOHO.h"
@implementation UILabel (YOHO)

-(void)yh_resizeWidth:(CGFloat)delta
{
    if (0 == [self.text length]) {
        return;
    }
    CGFloat stringWidth = 0;
    if([self.text respondsToSelector:@selector(sizeWithAttributes:)]) {
        stringWidth = roundf([self.text sizeWithAttributes:@{NSFontAttributeName: self.font}].width);
    }
    [self yh_setWidth:stringWidth + delta];
}

@end