Search code examples
iosswiftios-autolayoutautoresizestackview

Is it necessary to use autolayout to use stackview


Is it necessary to compulsory use autolayout to just use of stackview suppose i have made whole project without autolayout, now for particular screen i have to use the Stackview to equally divide the number of label inside the view. is there is any solution for that..

PROBLEM

actually i have to customize one of my old project done without autolayout, Now i have to just modify one screen which does not require any constraint but just stackview like uitablecell with 8 label in each cell equally divided.

I know we can do it by just calculating frame run time but is there is any other way to do it.


Solution

  • Yes, it is necessary to position the stack view itself using Auto Layout

    From the Apple Documentation:

    Although a stack view allows you to layout its contents without using Auto Layout directly, you still need to use Auto Layout to position the stack view, itself