Adding Buttons using Storyboard

Discussion in 'iOS Programming' started by RagingGoat, Oct 1, 2012.

  1. RagingGoat macrumors 6502

    Jun 21, 2010
    When adding buttons through a storyboard, how do you go about adding images on those buttons? I have images that will be our buttons but I'm not quite sure how to get them onto the buttons through storyboard.
  2. iJustinCabral macrumors member


    Jul 8, 2012
    In the accessibility window in the right column, change the button type to custom, and set your background image.

    Pretty simple.
  3. RagingGoat thread starter macrumors 6502

    Jun 21, 2010
    And just so I'm clear. The size for the buttons that xcode shows is in points, correct? Xcode shows my buttons as 102 x 104 so my images need to be 102 x 104 points.
  4. ArtOfWarfare macrumors G3


    Nov 26, 2007
    That is correct.
  5. RagingGoat thread starter macrumors 6502

    Jun 21, 2010
    One more quick question. When setting the background of the screen (behind the buttons) Can you select an image or does it have to just be a color? For example, my buttons are going to be images that when combined make up a larger image. Can the background be the rest of the image not included in the button images so that it looks like one image except for the space between buttons?
  6. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    You can have an image view that has your entire image and then arrange your buttons so they appear in front of the image view. Don't make the buttons subviews of the image view, just in front of it.
  7. Duncan C macrumors 6502a

    Duncan C

    Jan 21, 2008
    Northern Virginia
    You CAN set a background image for your view, or add an image view that your buttons lie on top of, as the other poster suggested. However, rotating between landscape and portrait will screw you up, and so will the different screen sizes on the iPhone and iPad.

Share This Page