Reputation: 4237
I am designing an iOS 7+ app on Xcode 6 for the iPhone 5s, iPhone 6, and iPhone 6+. I want to create a single design for all of these devices, so I am using Auto Layout. I would like the spacing between UI elements to be the same on all devices, but I am having trouble accomplishing this. Here's a screenshot of one of my UIButtons
on the iPhone 6 Simulator at 100% scale:
(The white boxes are spacer views, but don't worry about them.)
As you can see, the horizontal spacing from the left edge of the UIButton
to the left edge of the UIViewController
is 37px. On the iPhone 5s, this spacing is 32px. I would like the spacing to be 32px on all devices. On Auto Layout, I set my horizontal spacing constraint to a constant of 32. Even with this set, it seems to be scaling the spacing as well.
How can I prevent the horizontal spacing from scaling?
Upvotes: 0
Views: 342
Reputation: 309
I think your app is not iPhone 6 ready. If your app is iPhone 6 compatible, spacing will be 32px across all devices. Otherwise, iOS draws screen 320px in width and scale it to fit actual screen width. That's why you're getting 37px in iPhone 6.
To make app iPhone 6 compatible, create launch screen file (new file > iOS > User Interface) and assign it as the launch screen file in your project settings. Then app will launch in devices native screen resolution.
Upvotes: 1