根据文字计算大小

CGRect rect= [str boundingRectWithSize:CGSizeMake(100, MAXFLOAT) 
                                                  options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading 
                                               attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:20.0]} 
                                                  context:nil]; 

你可能感兴趣的:(根据文字计算大小)