12

Quick update, as I see a lot of interest in this now that iOS 10 is live. I ultimately opened a TSI and Apple responded back today indicating that I should open a bug for this. They didn't provide any further info or suggestions for workarounds, and the implication is that there is something wrong here.

In the meantime, I'm still digging for a workaround. I pulled my entire layout out of the StackView and replaced with autolayout constraints, only to experience the same issue. The problem may be with the MapView.


I have an issue where placing a few labels and a MapView in a vertical StackView. This view is not behaving consistently with iOS 10 / Xc8.

On the 6/S simulator, it renders properly. On the SE, the MapView actually appears larger than it did on the 6, and it covers up the labels. That resolves after a rotation (and it appears fine in the Storyboard preview)

I've demonstrated the behavior with an extremely simple project. It contains a Storyboard view with one vertical StackView that looks like this:

enter image description here

The StackView uses the Fill alignment and Fill distribution. There is no spacing.

Each label has a content hugging priority of 251 and compression resistance of 750.

The MapView has content hugging of 250 and compression of 750.

I've tried playing around with those numbers, but it never worked. In theory, the MapView has the lowest hugging priority so it should use up all extra space with the Fill distribution.

Instead, this is what I see (on the SE sim)

bottom two labels covered by the MapView

If I rotate the device and back - it looks fine. So it seems like there is some timing issue with the layout. However, I'm doing nothing in code here - the text of the labels is hardcoded in the storyboard. I don't do anything in code.

As mentioned, it looks fine on the iPhone6. It also looks fine if I arbitrarily tweak the heights of the labels. I noticed when the labels were all the same fontsize especially, it was fine. So I wonder if it's using the initial label's fontsize for calculating the intrinsic contentsize or something strange like that.

The iPad Air sim also has issues. In fact, the entire display is covered by the map initially, and I don't see the labels at all (until rotating).

I am not sure if ScrollViews are supposed to play nicely with StackViews. That said, I did try pulling the MapView out of there and pinning it below the StackView with autolayout. Surprisingly, I had the same end results.

Final note—I didn't test this with the sample project, but in my original project (exhibiting the same behavior) this occurred in Xcode 8 but not in Xcode 7.

jeffro37
  • 696
  • 6
  • 16

0 Answers0