ios6 - When I change the background of my UIButton it resizes -


i looking change uibutton background image using click event when buttons resize, can prevent this? code i'm using below.

uiimage *btnimage = [uiimage imagenamed:@"bttn_datesel_up.png"]; [startdtselbttn setimage:btnimage forstate:uicontrolstatenormal]; uiimage *btnimage2 = [uiimage imagenamed:@"bttn_datesel_down_clear.png"]; [enddtselbttn setimage:btnimage2 forstate:uicontrolstatenormal]; 

something you:

-(ibaction)btnclicked:(id)sender {   [startdtselbttn setimage:someotherbuttonimagenamehere forstate:uicontrolstatenormal] } 

this change image of button startdtselbttn.

also, if want button have 2 images 1 normal state , 1 selected image, can write code this:

uiimage *btnimagenormal   = [uiimage imagenamed:@"bttn_datesel_up.png"]; uiimage *btnimageselected = [uiimage imagenamed:@"bttn_datesel_up_selected.png"]; [startdtselbttn setimage:btnimagenormal forstate:uicontrolstatenormal]; [startdtselbttn setimage:btnimageselected forstate:uicontrolstateselected]; 

hope you.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -