Group Height Relative to Container constraint ignored at runtime

I'm building a simple app, a calculator, based on this example:

https://noodlewerk.com/blog/calculator-apple-watch-tutorial/


The layout of the buttons uses a few groups stacked up with a 0.2 size constraint relative to the container, and then the buttons are set up in a similar fashion using 0.25 width relative to the container a 1.0 relative height.


In the storyboard these constraints are applied correctly and the display looks fine, but at runtime (in both the simulator and on an actual 44mm Series 4 watch), the height constraint is ignored and instead renders as if it was set to Size to Fit Content. The width constraints are applied correctly, but the height constraints are not.


I've done a lot of searching and have not found this referenced elsewhere, and I cannot figure out why its going on. Seems like it started after the last Xcode drop (I could swear it was working correctly at one point - I guess I could roll back and see).


Has anyone else seen anything like this?

Replies

Did you roll back to see ?


Could you show, or simply draw here in text what you expect and what you get ?

It is a bit of a headache to try to imagine.


So, could you draw something like this (if you cannot post images on a site)


________________________ Overall group

| |

| __________________ |

| Button1 Button2 | | Sub Group 1

| __________________| |

| |

| __________________ |

| Button3 Button4 | | Sub Group 2

| __________________| |

| |

| |

| |

| |

|_______________________ |


And describe exactly all the Size and alignment constraints you have defined, for overall group as well as subgroups

Sorry I'm so late responding, didn't realize I'd gotten a hit. 😉


I did, in fact, roll back to Xcode 10.0 but it didn't help. The same rendering problem occurs.


Here's a screen capture that shows the layout in Xcode. I used gaudy colors to make the groupings visible. The main group is green, the rows alternate red and blue, the buttons flow horizontally in the rows. You can see that the button heights are filling to 20% as expected per their row constraints.


Here it is at run time in the simulator:


Notice that the row constraints appear to be ignored.


Admittedly I haven't looked back at this in a while because it got so annoying. I'd love to know what I'm missing.

Can a moderator tell me why my image links render when I'm editing but not in the posted response?

Hey, that's a known flaw of this forum: no images.


If you accept to post an email for a moment, we can continue exchange more info and code by mail.