Reputation: 17
So, I worked through how to move between storyboards, but now I am trying to figure out how button aligning and pinning works... I've set my alignments and constraints already, but for some reason when I build and run the app, the button just goes to the center.
What I mean by this in pictures.
This is getting me really confused, as the restraints seem okay after checking out a few tutorials talking about this, but it just moves to the center and it gets activated with a huge range. What I mean is that I press somewhere not even that close to the button and it immediately moves to the next storyboard, whereas I want it to stick to "Information" button in red.
I'm running it on an iPad Pro as a testing device through xcode's run options.
Thanks for all the help provided so far and I sincerely apologise for all the questions. Hopefully this is the last one...
Upvotes: 0
Views: 226
Reputation: 932
Add following constraints
For Button1 (i.e Rocker in your image)
For Button2 (i.e information in your image)
Now select Button1 and Button 2 both and select pin
option from the story board (appears at the bottom corner of storyboard (option 3 from left)),
align
vertical centers
and click on add constraint.Run your application now. Both buttons will be remains at the same place on any device. Find attached screenshots.
Upvotes: 2