Graphics not sizing/laying out properly

Discussion in 'iOS Programming' started by mike1360, Oct 13, 2014.

  1. mike1360 macrumors newbie

    Nov 9, 2013

    I'm pretty new to programming and am taking my first attempt at creating my own app. I then came across my first problem. I learned the code but not how the graphics are supposed to work. I am aware that you must make an @2x and @3x of each graphic to fit all devices. And that @2x means 2x larger and @3x means 3x larger. So, I've done that.

    I have 4 buttons, all with 3 different sizes. I placed the images into a button and lined them up 2x2. They fit just the way i wanted in the 4s and 5/5s simulator. But when I get to the 6, 6 plus, and iPads, they are just off centered and floating up there. What i want them to do is be centered and along the bottom again with an increased size to fill up the screen like it does on the 4s.

    I was thinking it may be fixed by applying constraints and I messed around with those a bit but it just extremely stretched out some and did nothing to others. So i'm not to sure.

    Sorry I don't know to much about this. If someone would be able to explain the graphics and how all the @2x and stuff works and how to fix my issue that would be amazing!

  2. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    I assume you're using Auto Layout, yes?

    What constraints have you set up? Please be as specific as possible.

    Also, it would probably help if you included screenshots of proper and messed-up layouts.
  3. mike1360 thread starter macrumors newbie

    Nov 9, 2013
    Sorry for lack of info. Here is a screenshot of the storyboard, the views on the different devices, files, and the constraints on.

    The constraints currently on are the two left side buttons to the left margin...the two right side buttons to the right margin...the two bottom buttons to the bottom of the screen...and the two top buttons to the bottom buttons. Then I just tried aspect ratio on all of them not knowing what it does (looks like it didn't work haha).
  4. mike1360 thread starter macrumors newbie

    Nov 9, 2013
    So i did a little more messing around and i applied a constraint on the buttons side by side with each other, going both ways.

    For example... Play -> Easy and Play <- Easy
    and Stats -> How To and Stats <- How To

    Then i also applied aspect ratio to all 4 of them. That seems to have worked for that issue i believe?

Share This Page

3 October 13, 2014