Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sizeWithFont:constrainedToSize:' is deprecated #25

Open
ik2wxx opened this issue Nov 25, 2013 · 2 comments
Open

sizeWithFont:constrainedToSize:' is deprecated #25

ik2wxx opened this issue Nov 25, 2013 · 2 comments

Comments

@ik2wxx
Copy link

ik2wxx commented Nov 25, 2013

/iToast.m:74:26: 'sizeWithFont:constrainedToSize:' is deprecated: first deprecated in iOS 7.0 - Use -boundingRectWithSize:options:attributes:context:

Please fix, thank you
Roberto

@brockboland
Copy link

Based on an answer over at StackOverflow, I replaced line 74 with the following:

  NSDictionary *attributesDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
                                          font, NSFontAttributeName,
                                          nil];
  CGSize textSize = [text boundingRectWithSize:CGSizeMake(280, 60)
                                          options:NSStringDrawingUsesLineFragmentOrigin
                                       attributes:attributesDict

I'll submit a pull request for this, though this would make the code require iOS 7. The README doesn't specify what version(s) of iOS are supported, but for the sake of iOS 6, I'll add a respondsToSelector: call.

@brockboland
Copy link

Actually, you'll still get the warning even with the respondsToSelector:, so I'm not going to bother with a PR. Either:

  • Support iOS 6, and iOS 7 devs deal with warning, or
  • Only support iOS 7, and I'm not sure @ecstasy2 wants to do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants