Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS: Change NSMutableAttributedString's Font Height Without Changing Font Width?

I have an NSMutableAttributedString "timeString" whom's font and color I have already set. Everything is working fine, but I was wondering if there were a way to alter the text's height without changing the text's width (font width = 100%, font height = 120%).

I tried using transform, but it's not available for NSMutableAttributedStrings. Thanks!

like image 657
KingPolygon Avatar asked Nov 10 '22 04:11

KingPolygon


1 Answers

There is no way to apply transforms to a string as a string is not actually a UI element. Your best bet in this case is to either add the Attributed String to a UILabel, transform the label's height and then draw the label in your context. Or transform whatever context you are drawing the text into.

like image 85
Jason Grandelli Avatar answered Nov 15 '22 11:11

Jason Grandelli