Search code examples
iosobjective-cswiftwatchkitapple-watch

Watchkit - How to set the element one below other in Group


I am working on the watchkit app and I want to create a table row with an image and two labels where the labels are one below the other, like this:

enter image description here

I tried the position options in interface builder, but no luck.

enter image description here

The labels are always on the same line:

enter image description here

I want the x-coordinate same for both. Please help.


Solution

  • At first, drag a Group onto the interfaceController, then change the Layout property of that group to Vertical:

    enter image description here

    Then drag the Labels in that group and set their properties accordingly:

    enter image description here

    If you need other alignments, add another group to the viewController.


    EDIT

    To achieve the table view you have posted in your question:

    1. put a group on the table row, set its layout to Horizontal
    2. put the image in that group, position Left
    3. put another group in that group, position Left, layout Vertical
    4. put the labels in that second group

    Looks like this:

    enter image description here