1

I have a Table View with a Prototype Cell. In it I have three labels: "aaaa", "-" and "bbbb".

enter image description here

"-" is Horizontally Centered in Container and I would like to place the "aaaa" label centered between "-" and the left margin or the left Table View border. Same with the "bbbb" in the other side.

Is there any way to center them between two objects or to align for example the "aaaa" label with the first segmented control segment and "bbbb" label with the second?

Thanks!

Victor Rius
  • 4,566
  • 1
  • 20
  • 28

1 Answers1

2

Yes it is possible. You can place place two views on either side of your middle label, lets call them leftView and rightView. leftView will go from left margin of cell to left margin of middle label. And rightView will be from right margin of middle label to right margin of cell. And now you can place each of your labels in rightView and leftView. Then you can add centre horizontally constraint to your labels.

Vishnu gondlekar
  • 3,896
  • 21
  • 35