ios - Setting a background image for highlighted state removes automatic highlight -


i'm implementing checkbox subclass of uibutton. there 2 background images (on/off) , 4 conceptual states:

  • on - on image / not highlighted
  • off - off image / not highlighted
  • on & pressed - on image / highlighted
  • off & pressed - off image / highlighted

if set background images on , off (uicontrolstatenormal , uicontrolstateselected), button gets highlighted when held.

however, when on & pressed, uses off image (as expected, because state uicontrolstateselected | uicontrolstatehighlighted, uses normal state image)

so set background image uicontrolstateselected | uicontrolstatehighlighted on image, programmatic highlight disabled - assume because if set specific background image state logic want override highlight.

i don't want use third image, possible set background image uicontrolstateselected | uicontrolstatehighlighted , still have programmatic highlight applied?

i'm calling [self setadjustsimagewhenhighlighted:yes]; after setting background image.

i guess using uibutton type not "custom" e.g. "rounded rect". in case setting background image can have unexpected side effects, see earlier question.
suggest change button type "custom". of course have define attributes own.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -