-1

How do you correct this?

'sizeWithFont:constrainedToSize:lineBreakMode:' is deprecated: first deprecated in iOS 7.0 - Use - boundingRectWithSize:options:attributes:context:

float height = [string sizeWithFont:[UIFont systemFontOfSize:15.0] constrainedToSize:CGSizeMake(widthOfTextView, 999999.0f)
lineBreakMode:NSLineBreakByWordWrapping].height + verticalPadding;
rmaddy
  • 314,917
  • 42
  • 532
  • 579
Coder
  • 499
  • 3
  • 13
  • 29
  • 1
    possible duplicate of [Replacement for deprecated -sizeWithFont:constrainedToSize:lineBreakMode: in iOS 7?](http://stackoverflow.com/questions/18903304/replacement-for-deprecated-sizewithfontconstrainedtosizelinebreakmode-in-ios) – rmaddy May 22 '15 at 02:38
  • Please search before posting. Other duplicates: http://stackoverflow.com/questions/18673176/sizewithfontconstrainedtosizelinebreakmode-deprecated?rq=1 and http://stackoverflow.com/questions/18834275/sizewithfontconstrainedtosizelinebreakmode-deprecated-in-ios7?rq=1 and http://stackoverflow.com/questions/18922252/sizewithfontconstrainedtosizelinebreakmodeis-deprecated?rq=1 – rmaddy May 22 '15 at 02:39
  • Yes, I have looked at these pages already. I just don't know how to apply their solution to my code. – Coder May 22 '15 at 12:59
  • Every one of the referenced duplicates have answers that show how to call `boundingRectWithSize...`. They all show how to pass in the font and the constraining size. If you are having issues, update your question with your attempts to use `boundingRectWithSize...` and explain what issues you are having. – rmaddy May 22 '15 at 14:56

1 Answers1

0

As the warning says, use the boundingRectWithSize:options:attributes:context: method instead.

bgilham
  • 5,909
  • 1
  • 24
  • 39