Varun Kumar Varun Kumar - 1 year ago 73
iOS Question

CGSize sizeSpace = [@" " sizeWithFont:self.fontHashtag constrainedToSize:rect.size lineBreakMode:self.lineBreakMode];

CGSize sizeSpace = [@" " sizeWithFont:self.fontHashtag constrainedToSize:rect.size lineBreakMode:self.lineBreakMode];


How to fix this Depreciated code ?

I'm a fresher so can you please explain elaborately?

Answer Source

sizeWithFont is depreciated so you need to use sizeWithAttributes method.

CGSize sizeSpace = [@" " sizeWithAttributes:@{NSFontAttributeName:self.fontHashtag}];