Background:
I'm creating a shop for a game I'm building in Xcode using SceneKit for the game, SpriteKit for the overlays, and UIKit for the shop and any other non-overlay view I may create. I have 9 buttons, all with default sizes of 700x700 scaled down in the storyboard to 90x90. I am trying to get all 9 of them to appear in a 3x3 format that resizes and spaces based on what screen the user has.
Note: contentView is a UIView with a lighter Blue background which contains all of my buttons.
(Image 1) What I want it to look like across all screens (Minus the blue outlines): https://prnt.sc/ndzqbz
(Image 2) What It looks like on the device I designed it for (Iphone 7 Plus): http://prntscr.com/ndzrkn
(Image 3) What It looks like on a different device (I pad Pro 12.9inch 3rd gen): http://prntscr.com/ndzrrh
Question:
How would I go about making Image 2, and 3 closer to Image 1?
I've been through a ton of auto-layout constraint videos and been all over the web and haven't found anything. Every time I tried something it would mess up Image 3 even more. Note: Image 3 is a 'cleaned' version of what I previously had, it used to have buttons of all different shapes and sizes everywhere they weren't supposed to be.
I've also tried the programmatical approach to solving this problem in Swift 5.0:
Code:
func setupButtons() {
player_button.frame = CGRect(x: contentView.self.frame.midX, y: contentView.self.frame.midY, width: 200, height: 200)
}
What I thought it would do is position my button in the middle of the view and increase the size of my button. It did increase the size of my button, but on the Ipad screen it positioned it here: http://prntscr.com/ndzxgo which is not in the middle of my contentView as I wanted. What it seems to have done is taken the contentViews original size and used that. I also cannot seem to get it to take the size of contentView with constraints applied (I did happen to get my contentViews constraints working for the most part.).
Other things to consider:
• I have attempted Resizing the images and putting them in Stack Views - I couldn't get it to work
Thank you for any feedback!