Reputation: 103
In an app that I use, there are 4 rows of buttons with each row containing 3 buttons. When I use the same app on an iPad, the alignment of the buttons becomes 2 rows containing 6 buttons each. Also, the width and height of the buttons change depending on the screen size. I want my app to have the same features but I don't know how to do it. Any help?
Upvotes: 3
Views: 10069
Reputation: 1493
Use Autolayout for defining constraints on buttons. There might be two cases :
Upvotes: 0
Reputation: 1824
You need to use size classes. Following is the link which helps you to understand size classes :
Size Classes or Adaptive layout
Upvotes: 1
Reputation: 319
1) You can use Autolayout constraints and size classes to make the view compatible to both iPhone and iPad screen sizes.
2) You can create and use separate Storyboards or .Xibs each for iPhone and iPad and use accordingly.
3) if the view does not have complex UI, then you can simply manage by doing it via code by detecting the view size, width height etc i.e whether it is iphone or iPad and then setting the frame, width, height of the UIElements like button, label, image view etc.
Upvotes: 5