I know there are lots of answers to similar questions but I have tried and tried but can't any of the replacements to work. The problem line is below where I am getting the error sizeWithFont
is deprecated use boundingRectWithSize: options: attributes: context:
CGSize contentSize = [myString sizeWithFont:[UIFont fontWithName:@"arial" size:12] constrainedToSize:CGSizeMake(650, CGFLOAT_MAX) lineBreakMode:NSLineBreakByWordWrapping];
I have also seen that sizeWithAttributes
should be used. And I have also seen that some replacement code is a number of lines long which hardly seems a step forward.
Can anyone help me with the correct replacement line?
Update:
I have tried
CGSize contentSize = [myString sizeWithAttributes: @{NSFontAttributeName: [UIFont fontWithName:@"Helvetica" size:12]}];
but that still leaves the
constrainedToSize:CGSizeMake(650, CGFLOAT_MAX) lineBreakMode:NSLineBreakByWordWrapping];
Is this no longer needed?