Search code examples
xcodeautolayoutapple-watch

How to Place Buttons Side-By-Side Xcode WatchKit


I am working on my first WatchKit app. I wanted to have one button in each corner of the Apple Watch. However, my project ends up looking like this:

Here is my interface.storyboard:

How can I put my buttons in the corner? I have aligned each button to the correct place in the interface (e.g. - horizontal left and vertical top for the yellow buttton). Thanks for your help.


Solution

  • Use 2 WKInterfaceGroup objects and set their alignment as:

    Set your groups layout to horizontal and

    For 1st Group set its vertical alignment to top

    For 2nd Group set its vertical alignment to bottom

    Now Add two buttons in each group and set their horizontal alignments:

    set 1st button to Left align and 2nd to Right align. do it for the 2nd group buttons too.

    For Further assistance and help see WatchKit Programming Guide