您的位置:首页 > 其它

label 调整label高度

2015-06-26 14:12 302 查看
//    CGFloat width1=[(NSString *)ob1 boundingRectWithSize:CGSizeMake(1000, FONTHEIGHT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16]} context:nil].size.width;
//    
//boundingRectWithSize: CGSize 对应 constrainedToSize: CGSize
//attributes:@{NSFontAttributeName: [ UIFont ] }
对应 sizeWithFont[ UIFont ]
//options: NSStringDrawingUsesLineFragmentOrigin
默认照填
//context: nil 默认照填

// - 返回一行的时候 str 的尺寸. 

CGSize size = [str sizeWithAttributes:dic];

CGSize size = [@"sdfsf" sizeWithAttributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:12]}];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: