user1657861
user1657861

Reputation: 281

Adjusting position of Multiple UILabels

I have a screen that has multiple UILabel. The labels are set to [myLabel sizeToFit]; along with myLabel.numberOfLines = 2;. This causes all the labels below this multiline label to overlap. Is there a smarter way to auto adjust the positions of all UILabel below this multiline labels so they do not overlap and adjust accordingly. I cannot use layoutSubviews as our app still has to support 4.3.

Thanks for your help in advance.

Upvotes: 0

Views: 113

Answers (1)

Rushi
Rushi

Reputation: 4500

  1. No it won't auto adjust. You'll have to do it with help of code.
  2. As the size of your UILabel is decided dynamically. You'll have to adjust the position of the UILabel which follows accordingly.
  3. Alternate solution to your problem is, you can use the UITableView.
  4. So even if your text increases. Rest of the UILabels which will be in another cell will be placed properly.
  5. As you can easily set the property to cell.textLabel it won't be much effort to create a UITableView.

Upvotes: 1

Related Questions