cordova-plugin-themeablebrowser icon indicating copy to clipboard operation
cordova-plugin-themeablebrowser copied to clipboard

can i toggle the image resource when clicked rather than while clicked ?

Open Blazzze opened this issue 9 years ago • 4 comments

the image when clicking on a button is given the imagepressed src only while the finger is on the button, how can i do that the image will toggle between the pressed and the NOT-pressed when clicking ?

thank you :)

Blazzze avatar Aug 03 '16 14:08 Blazzze

also looking for this specific feature. please update if you found something.

adinu avatar Aug 08 '16 09:08 adinu

Hey, how did you solve the problem?Can you please share?

huangdashun avatar Nov 09 '16 10:11 huangdashun

a friend changed the code for me (i dont understand in objective C)... ill try to find the differences and post it here

Blazzze avatar Nov 09 '16 10:11 Blazzze

well, only wanted to try creating ios app (if forgot to mention) (and used the wwwImage) so in the file CDVThemeableBrowser.m look for the line:[result setImage:buttonImagePressed forState:UIControlStateHighlighted]; and change to: [result setImage:buttonImagePressed forState:UIControlStateSelected];

and look for this: [self emitEventForButton:_browserOptions.customButtons[index] withIndex:[NSNumber numberWithLong:index]];

and add this afterwards:

UIButton * btn = ((UIButton *)sender);
[btn setSelected:!btn.isSelected];

again this is only for ios, have no idea about other platforms

Blazzze avatar Nov 09 '16 10:11 Blazzze