Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 896
Aabasaheb Deshpande Avatar asked Feb 11 '14 06:02

Aabasaheb Deshpande


1 Answers

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];
like image 89
Vivek Sehrawat Avatar answered Nov 04 '22 04:11

Vivek Sehrawat