UISlider constant distance away from bottom when AutoSizing
-
28-10-2019 - |
Question
I want to fix a UISlider a constant distance away from the bottom of the screen. I can do this easily in the interface builder size inspector. I would simply use the red I shaped locks at the edge of autosizing square. In the image below it would lock to the top left.
I want to lock to the bottom and do it programmatically, not with interface builder.
I've been using the following code to resize but i now want it locked to the bottom : view.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)
Please help.
Solution
You need to have flexible top margin. You can also add UIViewAutoresizingFlexibleWidth
to see how it resizes horizontally.
view.autoresizingMask = UIViewAutoresizingFlexibleTopMargin;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow