ios – Why is my UIStackView’s fill proportionally distribution property not working as anticipated?


I’ve two buttons in a vertical stack view with the very same title, font and font measurement. They need to thus have the identical intrinsic measurement alongside the vertical path and UIStackView.Distribution.fillProportionally ought to give them each the identical top however once I test their respective frames within the measurement inspector one button’s top is bigger than the opposite’s, why?
UIStackView.Distribution.fillProportionally
One buttons top is 94 whereas the opposite’s is 86. Fill equally works as anticipated nonetheless.enter image description here
enter image description here

I printed the frames’ heights they usually come out the identical as within the storyboard 94 and 86 which do not match.

override func viewDidLayoutSubviews() {
    tremendous.viewDidLayoutSubviews()
    print("button 1 top: (button1.body.top)")
    print("button 2 top: (button2.body.top)")
  }

Terminal output

button 1 top: 94.0
button 2 top: 86.0
button 1 top: 94.0
button 2 top: 86.0

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles