Reputation: 1
I have following warning to use code in iOS 7.0 it will display that use sizeWithAttribute:
here is the following code that I have used:
messageSize = [theMessage sizeWithFont:[UIFont systemFontOfSize:20.0]];
if any one have suggestion how to remove the above code with sizeWithAttribute:
so please tell me.
Upvotes: -5
Views: 168
Reputation: 299
CGSize size = [theMessage sizeWithAttributes:
@{NSFontAttributeName:
[UIFont systemFontOfSize:20.0f]}];
Hope it helps...
Upvotes: 0
Reputation: 6454
Use sizeWithAttributes: instead, which now takes an NSDictionary. Pass in the pair with key UITextAttributeFont and your font object like this:
CGSize size = [string sizeWithAttributes:
@{NSFontAttributeName:
[UIFont systemFontOfSize:20.0f]}];
Thanks
Upvotes: 0