Adding images to buttons in interface builder
I want to add an image to my button instead of text. 开发者_C百科Can I do this in interface builder? Any example I can look at?
Thanks Deshawn
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.
- Add the image in your project.
- In IB set the button type to custom.
- Set the image in
Image
orBackground
box just below theTitle
box.
That's all.
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.
精彩评论