iOS零碎笔记

2/13/2017来源:iOS开发人气:489

//自适应内容的高度

-(CGSize)getLabelText:(NSString *)text{

    

    CGSize maxSize = CGSizeMake(WIDTH-20*SCALE, 300*SCALE);

    NSDictionary *dic = @{NSFontAttributeName:[UIFont systemFontOfSize:16.0]};

    NSStringDrawingOptions options = NSStringDrawingUsesLineFragmentOrigin;

    CGSize labelSize = [text boundingRectWithSize:maxSize options:options attributes:dic context:nil].size;

    return labelSize;

}