-1

I have created an app for iPhone 6. I can launch it on an iPhone 5 or 4S, but since the screen is smaller, I have some design issues. For example I user a UITableViewCell, and each RowHeight equals 560. I also have four square buttons equaly repartited horizontally.

When I launch my app on an iPhone 5/4S, the cell takes more than the size of the screen (and I need the cell size to be smaller or equal the size of the screen). Using Editor -> pin, etc I have managed to keep my 4 buttons equally repartited horizontally, but consequently they are not square buttons any more...

How can I solve that issue? The purpose is then to publish this app on the App Store, so I am wondering how can I do to have a cool app on each iPhone...

Thank You!!

skifen128
  • 35
  • 3
  • 1
    size classes and auto layout – vijeesh Jul 28 '15 at 09:42
  • can you be a little more specific? Thanks – skifen128 Jul 28 '15 at 09:43
  • https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/Introduction/Introduction.html https://developer.apple.com/library/ios/recipes/xcode_help-IB_adaptive_sizes/chapters/AboutAdaptiveSizeDesign.html – Stefan Jul 28 '15 at 09:48

2 Answers2

0

It is a little pain to add everything afterwards, having some UIView sizes hardcoded. Really the only thing to point out is to use AutoLayout with size classes and extensive use of constraints.

To build Adaptive UI I can point you directly to Apple's resources. Especially last year's WWDC talk - Building Adaptive UI with UIKit.

It is generally a bad practice to give you links to tutorials here, but for start, check this tutorial.

Michal
  • 15,429
  • 10
  • 73
  • 104
0

You need to use constraints and use 600x600 devices in Storyboard. Then distribute your elements in each view and then select all of them and use "Add missing constraints" so it will adapt in each device.

Here you can do it for each element or for the entire view. I recommend you to do it element by element cause if you do it for the entire view maybe you face some problems, but its ok, you need to try and catch ;D

enter image description here

Then if you want to control the sizes you need to add size constraints control+leftClick and drag to the same element, you will be allowed to add Height or Width constraint.

enter image description here

Maybe you need to setup some constraints manually, but you will learn how to do it really fast, just some views and you will get it.

Hope this helps.

Norolim
  • 926
  • 2
  • 10
  • 25