iPhone formatting issue

Discussion in 'iOS Programming' started by macone123, May 6, 2015.

  1. macone123 macrumors newbie

    May 5, 2015
    Question regarding auto layout.

    I have my labels/buttons/images in the center of the iphone storyboard. Everything looks great in the iPhone 6 and iphone 6 plus. Only issue is when I have the simulator open in iphone 5s or iphone 5, the labels/buttons/images won't center on the screen.. The right side of the image/labels are cut off due to the screen being obviously smaller. Auto layout is on.

    I tried adding constraints, everything looks fine in iphone 6 and plus, but the iphone 5 is giving me an issue. When I center with constraints the iphone 5 simulator deletes some of my buttons or they don't look correct, or still are not centered the middle of the screen. I tried adding a lead constraint and following constraint, still without any resolvement.

    I was just wondering if anyone know of a tip to make this work a little better?
  2. bjet767 macrumors 6502a

    Oct 2, 2010
    There is no easy tip to make this work. You will have to learn through trial and error how to set the constraints for the layouts. Some of them fix a position to a spot, some attached them to other objects and some are relative to the screen borders.

    Keep adjusting and eventually it will work out.
  3. macone123 thread starter macrumors newbie

    May 5, 2015
    iPhone 5

    Formatting seems to be fine in iphone 6 and iphone 6 plus. Main issue is the iPhone 5/5s.... Every constraint i use seems to somehow delete the option from the screen.

    I'll keep messing around with it.

    Much thanks.
  4. bjet767 macrumors 6502a

    Oct 2, 2010

    I found constraints difficult to master, especially when you click on the add "suggested" ones. These often, quite often, do not work on all the devices because of the differences in screen sizes.

    What I recommend you do if you can't work it out is design for a single phone, like the 5, and then test the view on a larger device to see how things move. You will also have to do a lot of simulated device rotation to see how it looks in both landscape and portrait views.

    It a hassle to make a universal app, but in the end worth it.
  5. macone123 thread starter macrumors newbie

    May 5, 2015

    So it looks like it is possible to use:

            main.center = CGPointMake(20, 200);
    When Autolayout is turned off, you can move the the UILabel to the correct positioning, but I was wondering if anyone had any other ideas to do this without completely turning off all of Autolayout for the whole project?

    Is there a way to disable it for one screen anyone knows of so I will be able to set the position of labels?

Share This Page

4 May 6, 2015