Bob Williams Bob Williams - 7 months ago 67
Swift Question

how to make contents in my app universal?

I have made an app that fits all my contents perfectly on Iphone 6, but when I run it on any other device, the positions are shifted. How do I fix this using UIKit on Xcode


make the size and position relevant to the screen size for example:

Image.position = CGPoint(x: (scene?.size.width)! * 0.1, y: (scene?.size.height)! * 0.2)

Image.size = CGSize(x: (scene?.size.width)! * 0.6, y: (scene?.size.height)! * 0.6)

i use scene as a reference majority of the time but frame size works as well by replacing the (scene.size.height)! portion with

(self.frame.size.width) or (self.frame.size.height)