Adding Buttons using Storyboard

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

  1. RagingGoat macrumors 6502

    Joined:
    Jun 21, 2010
    #1
    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

    iJustinCabral

    Joined:
    Jul 8, 2012
    #2
    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

    Joined:
    Jun 21, 2010
    #3
    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 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #4
    That is correct.
     
  5. RagingGoat thread starter macrumors 6502

    Joined:
    Jun 21, 2010
    #5
    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 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #6
    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

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #7
    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