0

I originally built my app with a iPhone 6 4.7in size. I tried to set constraints for a 4.0in size but a button is being cut off. The app has three columns of buttons inside a scroll view. Either the right most button is halfway cut off or the middle button is distorted. I can't figure out how to set constraints for buttons. Do size classes and auto layout fit into this? This is my first app so I'm fairly new to all of this.

  • If you are going to have 3 columns of buttons that you want to scroll, it may be easier to use a UICollectionView instead of a scrollview. Go here for more details: http://stackoverflow.com/questions/31735228/how-to-make-a-simple-collection-view-with-swift – Jeff Lewis Jul 30 '15 at 22:46
  • My buttons have images. I'm not sure if collection view can do that – Taabish Kathawala Jul 30 '15 at 22:59
  • Yeah it can, you just need to drag out a UIImageView into the collection view cell in your storyboard, then connect that into your collection view controller with an IBOutlet. From there you can pass an array of images into the UIImageView in the CellForItemAtIndexPath method. – Jeff Lewis Jul 30 '15 at 23:05
  • @TaabishKathawala how have you implemented the constraints? Are they fixed size constraints (e.g. button height is set to 20px) or are they auto constraints that take their sizes based off their surroundings (e.g. button is located 10px from the control above it and 20 px from the control below it).. – Matt Kelly Jul 30 '15 at 23:21

0 Answers0