123456789101112131415161718192021 |
- //
- // NSString+CGSize.m
- // TheoryNetwork
- //
- // Created by tederen on 2019/10/15.
- // Copyright © 2019 tederen. All rights reserved.
- //
- #import "NSString+CGSize.h"
- @implementation NSString (CGSize)
- + (CGSize)calculateSizeWithString:(NSString *)string fontSize:(CGFloat)size {
- UILabel *label = [UILabel new];
- label.text = string;
- label.font = [UIFont systemFontOfSize:size];
- return [label sizeThatFits:CGSizeZero];
- }
- @end
|