You need to use the sizeWithAttributes property.
CGSize mysize = [string sizeWithAttributes:@{NSFontAttributeName: [UIFont systemFontOfSize:14.0f]}];
You can also set it to an already created font size in order to reduce recoding if you use the size more than once:
CGSize mysize = [string sizeWithAttributes:@{NSFontAttributeName: label1.font}];
I do not believe you can use constrainedToSize with this property. It would have to be separately set on a CGRect.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…