nathan
nathan

Reputation: 163

How to pin button to bottom of view Storyboard iOS

I have a button that needs to "stick" to the bottom of the main view on both 3.5 inch and 4" iPhones. Currently, I can move it right to the bottom of the storyboard on a 3.5" view but then on a 4 inch view, it moves up.

How do I stick the button to the bottom of the view on both screen sizes?

Upvotes: 4

Views: 7321

Answers (2)

bpolat
bpolat

Reputation: 3908

Select your button which you want to pin to bottom. Click on add new constraints and select bottom constraints then click on add.

Add New Constraints

Upvotes: 8

Aman Agnihotri
Aman Agnihotri

Reputation: 3033

Use AutoLayout feature.
While you're laying UI components on the screen, you see some blue colored guidelines, those are just helper lines and have no effect whatsoever when you actually run the program.
Once you're done with placing all the UI components on the screen, you have to actually set the constraints for the AutoLayout using the few buttons that are placed in the bottom right part of the Storyboard view.

Is suggest that you right click on the Storyboard view, and go into "Interface Builder Help" option, and then click on "Understanding Layout Constraints" and "Aligning and Pinning Objects" to see how constraints are actually set.

Upvotes: 3

Related Questions