Conversation
Your code was giving warning about deprecation on iOS 7. This solved the problem for me.
|
Your class is great. I would like to suggest two things to add:
Beyond that the rest is perfect. |
|
Thanks for the pull request. I'll look into it. Regarding your second post:
|
|
ah, sorry about that, I will look at it. |
|
Is there a reason not to use NSString's boundingRectWithSize:options:attributes:context:, as suggested by the compiler warning? I think it would avoid creating a UILabel just to calculate the rect. |
|
Because it’s only available in iOS 7 and later. I don't want to break projects targeting earlier versions of iOS. |
|
The label version works with barely all versions of iOS and works wonderfully and also my first version was using NSString's boundingRectWithSize:options:attributes:context: for a iOS 7 project and I discovered this method does not work correctly for some kinds of strings. I ended having wrong sizes all the time. Replacing it with the label method solved the problem. |
|
Yes, but it seems to me that instantiating a label just to get its size may be too much overhead for the task. I'll take a closer look at this issue on the weekend. |
Your code was giving warning about deprecation on iOS 7. This solved the problem for me.