Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift 3: Get distance of button to bottom of screen

I want to get the distance of a button to the bottom of the screen in Swift 3.

I can see the correct value in the Storyboard when I look at the distance (alt key) but unfortunately I am not able to calculate it manually.

The value I am looking for is the same as the constant in the "Vertical Spacing to Bottom Layout" constraint for the button.

view.frame.maxY - randomButton.frame.maxY

gave me a value way too high.

like image 942
Michael Avatar asked Jan 27 '17 17:01

Michael


1 Answers

view.frame.size.height - (button.frame.size.height + button.frame.origin.y)

I think its ok! Hope it helps

like image 57
Lucas Palaian Avatar answered Nov 15 '22 11:11

Lucas Palaian