initialxy / cordova-plugin-themeablebrowser

Fork of org.apache.cordova.inappbrowser in an attempt to make it a bit more themeable and configurable to add some custom actions.
Apache License 2.0
294 stars 221 forks source link

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

Open Blazzze opened 7 years ago

Blazzze commented 7 years ago

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 :)

adinu commented 7 years ago

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

huangdashun commented 7 years ago

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

Blazzze commented 7 years ago

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

Blazzze commented 7 years ago

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