Posts

Post marked as solved
10 Replies
That's a great idea. I'll try that. Thanks a lot!
Post marked as solved
10 Replies
Here's how the constraint is defined: First Item: Stack View.Center XRelation: EqualSecond Item: Safe Area.LeadingConstant: 0Priority: 1000Multiplier: 2Is there a way I can align the stack view to the safe area's leading proportionally in a square screen device? I want there to be a short distant between the stack view and the safe area's leading. I also want the distance to adjust itself automatically according to the screen size of the device.
Post marked as solved
10 Replies
Is there a way I can align a stack view to the safe area's leading proportionally in a square screen device? I want there to be a short distant between the stack view and the safe area's leading. I also want the distance to adjust and change automatically according to the screen size of the device.
Post marked as solved
10 Replies
Yes. I set the stack view's horizontal center to be the same as the safe area's leading so the left half of the stack view will be invisible initially. The constant is set to 0. And then I tried to change the multiplier to 2 in order to move the stack view to the right a little bit to make the left half of the stack view visible. This works on devices with the notch but not notch-less devices. So it works perfectly on iPhone X but not on iPhone 8.I suspected that other constraints might be causing this issue so I tried this on a new project and a new blank view controller. I set the stack view's center to be the same as the safe area's leading. Constant 0 and multiplier 2. And I still get the same problem. It works as expected on iPhone X but it doesn't work on iPhone 8. On iPhone X, when multiplier is set to 2, the stack view moves to the right a little bit so the left half of the stack view is no longer hidden. On iPhone 8, the stack view doesn't move at all even though multiplier is set to 2. Even if I change multiplier to 4, the stack view would still stay at the same place as if multiplier is still set to 1. I don't have any other constraints on the view controller, I don't know what's causing this problem. This is so weird.