ios - How do I make a button stay pressed? -
okay have app i'm building complete. i'm having 1 problem, when press button makes sound , button's image changes. image changes when being touched or "highlighted" , buttons image remain changed through duration of sound effect after sound effect revert original image. there anyway can set uibutton "set time" or "highlighted" option?
i feel embarrassed sometimes, because seem tripped these trivial things, when handle core coding exceptionally , near finish full app in days time, first app , i'm still newbie xcode. appreciate community's answer pushes me forward appreciated!
i further apologize questions formatting typed on iphone hope it's not awkward or lacking in detail. if needs more detail ask!
1.you dont want reflection of image @ highlighted , selected state. put same image state like
[btnclear setbackgroundimage:[uiimage imagenamed:@"blue_button.png"] forstate:uicontrolstatenormal]; [btnclear setbackgroundimage:[uiimage imagenamed:@"blue_button.png"] forstate:uicontrolstatehighlighted]; [btnclear setbackgroundimage:[uiimage imagenamed:@"blue_button.png"] forstate:uicontrolstateselected];
2.now if want image change @ sound stop time make
[btnclear setbackgroundimage:[uiimage imagenamed:@"red_button.png"] forstate:uicontrolstatenormal]; [btnclear setbackgroundimage:[uiimage imagenamed:@"red_button.png"] forstate:uicontrolstatehighlighted]; [btnclear setbackgroundimage:[uiimage imagenamed:@"red_button.png"] forstate:uicontrolstateselected];
and again on button click toggle image first one.
Comments
Post a Comment