计算字符串长度

#pragma mark--计算字符串长度

- (CGSize)strsizewithstr:(NSString *)str{

    NSDictionary *attributes = @{NSFontAttributeName:[UIFont systemFontOfSize:20]};

    CGSize textSize = [str boundingRectWithSize:CGSizeMake(100, 100) options:NSStringDrawingTruncatesLastVisibleLine attributes:attributes context:nil].size;

    return textSize;

 

}

posted @ 2017-03-31 15:24  柳仙慧子  阅读(145)  评论(0编辑  收藏  举报