Change the label width dynamically inside a UITableViewCell

后端 未结 3 1223
忘掉有多难
忘掉有多难 2021-01-03 12:15

I am trying to build up an custom table view.

\"enter

As you can see in the pi

3条回答
  •  醉梦人生
    2021-01-03 12:37

    If you are using auto layout, you can just set the x and y position, and then nothing for the height and width, and the label will correctly size itself to fit its contents. One caveat if you are using Xibs or Storyboards, don't put any text in your label in the storyboard, or it will want to size to that text. So delete the placeholder text from the storyboard, set the constraints and then you will be good to go.

提交回复
热议问题