解决方法:
NSString *myText = @"xxxxx";
将
CGSize mySize =[myText sizeWithFont:myFont constrainedToSize:CGSizeMake(200,100)];
改写成:
CGSize mySize = [myText boundingRectWithSize:CGSizeMake(200,100) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:myFont} context:nil].size;
'sizeWithFont:constrainedToSize:' is deprecated: first deprecated in iOS 7.0 - Use -boundingRectWithSize:options:attributes:context:
时间: 2024-12-13 15:10:44