7

I want to add an image to my button instead of text. Can I do this in interface builder? Any example I can look at?

Thanks Deshawn

user605957
  • 2,489
  • 6
  • 25
  • 33
  • 4
    its literally the option below "title" on a UIButton in interface builder. its called "image", alternatively, there is the "backgroundImage" property that is right below these. – Jesse Naugher Jun 13 '11 at 16:15
  • Sorry but I dont see a title option anywhere... I am using Xcode 4 and when I highlight my button, I dont see any option for title. – user605957 Jun 15 '11 at 05:07

3 Answers3

13

1:select the button

2:select Attributes Inspector

3:change type to Custom

4:There are two ways to do this using the interface builder

-1: Make a button image->include it in your project->set the image as the "image" of the button.

-2: Make a button background image->include it in your project->set the image as the "background" of the button->set the "Title" of the button to anything you want.

Peter Zhou
  • 3,881
  • 2
  • 21
  • 19
  • you need to change type to custom after setting image as wierd things happen if you don't do so – FAFI Jun 19 '13 at 15:20
4
  1. Add the image in your project.
  2. In IB set the button type to custom.
  3. Set the image in Image or Background box just below the Title box.

That's all.

taskinoor
  • 45,586
  • 12
  • 116
  • 142
1

I actually had to drag and drop the images folder into the Project Navigator and chose that the folder is a reference and only then, I could see the images in the Media Library.

From there the only thing you need to do is drag the picture where you want or change for the image name in the Attribute inspector.

OhadM
  • 4,687
  • 1
  • 47
  • 57