Today I have a task with adjusting the center.y of the image view relative to 0.4 of the launch screen height. As you know, it cannot be customized with view controllers because the launch screen is independent. This is why I am setting up the image view through the storyboard. On different screens, the image is displayed at different heights, since the rigidly anchored top constraint sets a specific value (270, for example). In my case, it is necessary that the launch screen itself counts 0.4 from the height of its view and set this value for the center of the image view. How can I do this with storyboards?
Asked
Active
Viewed 908 times
2 Answers
1
First, add a center Y constraint like this:
The constraint's second item would be Superview.Center Y. Change that to Superview.Bottom instead:
Because the superview in this case is the root view, its bottom will be equal to its height. Now you can change the multiplier to 0.4 to achieve the desired effect.

Sweeper
- 213,210
- 22
- 193
- 313
0
adjusting the center.y of the image view relative to 0.4 of the launch screen height
You cannot set a center anchor in relation to a height. There is no such relationship.
Use an invisible spacer view with its top pinned to the top of the superview. The spacer view height can be set relative to the superview height, and now the image view vertical center can be set relative to the spacer view bottom.

matt
- 515,959
- 87
- 875
- 1,141