I have a UIButton that I have set to sit 8 points from the left and 8 points from the bottom of my view. I currently have the width and height set to >= 32 points.
But, I want the button to be larger on larger displays. I worked out how to set constraints so that the button is always at the same aspect ratio (square in my case) and always 10% of the width of its parent view, but that means when a device is rotated the button gets bigger and smaller as the view gets wider and narrower and I don't want that. I want it to be 10% of the shortest side.
It's easy in the enclosing ViewController code to get my desired width:
let buttonWidth = 0.1 * (self.view.bounds.width < self.view.bounds.height ? self.view.bounds.width : self.view.bounds.height)
But how do I correctly apply this to the button and what constraints should be in place from the storyboard? The entire interface is currently defined in the storyboard.
Do I update the bounds directly? A constraint? Multiple constraints? In the case of constraints I am completely unfamiliar with how deal with them in code.