Pages

Sunday, May 22, 2011

Iphone: Set Image on UIButton

Iphone: Set Image on UIButton

On UIButton, Image Can be set as Button image or can Button Background Image.

Basically, Button Image Is not useful to set because if we set button image then Button will enlarge
according to the image size.

So it is useful to set Image on background. In this case, the image will fit to button Size.
so it can be use many places where we will have to use button and ImageView both such as Add contact image,etc..................

set Button title:
[imageButton setTitle: @"XYZ" forState: UIControlStateNormal];


Set Button Background image
[imageButton setBackgroundImage:image forState:UIControlStateNormal];

Set Button Image:
[imageButton setImage:image forState:UIControlStateNormal];


thank.........

No comments:

Post a Comment