IOS根据字符串的长度和文字大小,获取其宽度和高度

2019-04-23  本文已影响0人  幽玄727

    NSDictionary *attributes = @{NSFontAttributeName:self.font};

    CGSize fontSize = [self.text boundingRectWithSize:CGSizeMake(self.frame.size.width, MAXFLOAT) options:NSStringDrawingTruncatesLastVisibleLine attributes:attributes context:nil].size;


上一篇 下一篇

猜你喜欢

热点阅读