Button with Image


 

Button with Image

In the given Iphone SDK tutorial, we are creating a button with image on it. There is nothing in adding image on button if you are aware of the features available in the interface builder toolbar...lets find out the steps.

In the given Iphone SDK tutorial, we are creating a button with image on it. There is nothing in adding image on button if you are aware of the features available in the interface builder toolbar...lets find out the steps.

Button with iPhone Image

In the given Iphone SDK tutorial, we are creating a button with iPhone image on it. There is nothing in adding Images of Iphone Buttons if you are aware of the features available in the interface builder toolbar...lets find out the steps.

Steps of adding image on Button into iPhone:

1. Image should be added into the resource file: To add the image in resource file...select and right click on it & choose Add ->Existing file.
Now Select the file and click on ->add -> add
It'll add the image file in the resource folder. See the below given images for more help...

Right click on resource to add the image.

Select the image name as we did, and click on add button.

Choose add

Browse the resource folder for new added image...

2. Now open XIB file and then open interface builder and select button on which you have to set the image

3. Drag and drop the button on view, select the button and click on tool->Inspector

4. Choose the type of button you require...we have given it "custom" type. Custom type generally adjust the button according to image size.

5. At image set the image file name & ...


6. Save the file. To test the application just click Build and go... the output will be like given image..



Note: You can set image on button in both ways ..1. As image on button & 2. as button background. The only difference is that you can write text on background but not on button image.

Download the Source Code

Ads