My code is
CGSize textSize = [text sizeWithFont:font constrainedToSize:CGSizeMake(self.bounds.size.width - 106, CGFLOAT_MAX) lineBreakMode:NSLineBreakByWordWrapping];
Anyone knows how can i fix this warning?
Swift
// adjust the label height (top align text)
// old
var labelSize: CGSize = model.name.sizeWithFont(self.nameLabel.font, constrainedToSize: maxNameLabelSize, lineBreakMode: self.nameLabel.lineBreakMode)
// new
var labelSize: CGSize = model.name.boundingRectWithSize(maxNameLabelSize, options: .UsesLineFragmentOrigin, attributes: [NSFontAttributeName: self.nameLabel.font], context: nil).size
Objective c
// adjust the label height (top align text)
// old
CGSize labelSize = [model.name sizeWithFont:self.nameLabel.font
constrainedToSize:_maxNameLabelSize
lineBreakMode:self.nameLabel.lineBreakMode];
// new
CGSize labelSize = [model.name boundingRectWithSize:_maxNameLabelSize
options:NSStringDrawingUsesLineFragmentOrigin
attributes:@{NSFontAttributeName: self.nameLabel.font}
context:nil].size;
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments