Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding images to buttons in interface builder

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

like image 611
user605957 Avatar asked Jun 13 '11 16:06

user605957


People also ask

How do I add a picture to my button on storyboard?

Select the Attributes Inspector in the far right Utilities Panel. Make sure that the button is selected on the storyboard. In the input labeled Title, you can change the title text. In the Background combo box, you can select an image that will show up behind the button text.

What is a button image?

Displays a button with an image (instead of text) that can be pressed or clicked by the user. By default, an ImageButton looks like a regular Button , with the standard button background that changes color during different button states.


2 Answers

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.

like image 79
Peter Zhou Avatar answered Oct 18 '22 18:10

Peter Zhou


  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.

like image 32
taskinoor Avatar answered Oct 18 '22 19:10

taskinoor