Aabasaheb Deshpande
Aabasaheb Deshpande

Reputation: 399

Does not display images on UIButton

Thanks in advance please forgive me if i am unable to explain the problem correctly.

By using xcode 4.6 i was successfully added image on the button but when i am trying display image on the button by using xcode 5.0.2 it not appears on the button properly .

Below is the code for where i am adding image on the button

[checkBtn1 setImage:[UIImage imageNamed:@"Checkmark_uncheckcheck.png"] forState:UIControlStateNormal];
[checkBtn2 setImage:[UIImage imageNamed:@"Checkmark_uncheckcheck.png"] forState:UIControlStateNormal];
[checkBtn3 setImage:[UIImage imageNamed:@"Checkmark_uncheckcheck.png"] forState:UIControlStateNormal];
[checkBtn4 setImage:[UIImage imageNamed:@"Checkmark_uncheckcheck.png"] forState:UIControlStateNormal];

This is how it looks:

enter image description here

Upvotes: 5

Views: 3942

Answers (1)

Vivek Sehrawat
Vivek Sehrawat

Reputation: 6570

After seeing the screenshots, i think you are using roundrect button type put it custom and setBAckground image instead of setimage

UIButton * checkBtn1 =[UIButton buttonWithType:UIButtonTypeCustom];
[checkBtn1 setBackgroundImage:[UIImage imageNamed:@"Checkmark_uncheckcheck.png"] forState:UIControlStateNormal];

Upvotes: 13

Related Questions