Varun Kumar Varun Kumar - 4 months ago 20
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

sizeWithFont is depreciated so you need to use sizeWithAttributes method.

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