How to render stretched text in iOS?

前端 未结 3 834
醉梦人生
醉梦人生 2020-12-23 23:51

Given a rectangular area, I want to render some text using a specific font and have the rendered text fill out the rectangle. As in the image below:

3条回答
  •  囚心锁ツ
    2020-12-24 00:25

    You can set the UILabel transform property and scale the width:

    [myLabel sizeToFit];
    myLabel.transform = CGAffineTransformMakeScale(0.5, 1.0);
    

提交回复
热议问题