Search code examples
iosuitableviewautolayoutstoryboarduilabel

How can I add constraints to 4 labels in a UITableViewCell


Hi I am working on an Universal App, I have a Header Cell and Prototype Cell with 4 Labels each. For the Header Cell I was able to add the constraints since the 4 Labels have equal widths, but for the Prototype Cell the last label has a smaller width and a disclosure Indicator next to it. I would like to show the labels as they are seen in my Storyboard. How can I add constraints to show my labels the same way in every device? Here is the screenshot enter image description here


Solution

  • First of all you are applying on first label' top,leading,equalwidth to cell , then usemultipliyeron equalwidth 0.25 then on secondlabelHorizontal spacing ,equal height,width,center vertically fromlabel` first . Same on below labels but vertical spacing from upper lable then same on other label above mention. If you want to space between labels then put value in horizontal spacing.

    double click on equal width then open this kind of window

    put multiplier in 0.25

    then it see like this

    enter image description here