UILabel sizeToFit method not working properly

后端 未结 6 1063
梦如初夏
梦如初夏 2021-01-01 11:52

I\'m trying to show a long chunk of text inside a UILabel in one line. The UILabel is a subview of UIScrollView so I can scroll and see the entire UILabel.

My proble

6条回答
  •  我在风中等你
    2021-01-01 12:38

    If you want to achieve this with auto layout turned on it's simple. Just make sure you add numberOfLines

    textLabel.adjustsFontSizeToFitWidth = YES;
    textLabel.numberOfLines = 0;
    

提交回复
热议问题