Override Highlighted for UIButton?

Discussion in 'iPhone/iPad Programming' started by ArtOfWarfare, Dec 9, 2009.

  1. macrumors 603

    ArtOfWarfare

    #1
    I would like to make it so that a button highlights when it's selected, and remains highlighted until another is selected.

    Any suggestions?

    I have tried simply adding to the method that the button invokes to have it remain highlighted, but that doesn't work because UIButton automatically unhighlights itself on touch up after the method it invokes is called.
     
  2. Guest

    Darkroom

    #2
    not sure if it's possible to control the highlight graphics like you want simply with IB. you'll have to roll your own highlight animations that make good use boolean variables, etc. the attached file should help you.
     

    Attached Files:

  3. macrumors 603

    ArtOfWarfare

    #3
    I found a way to make it work.

    The method that the button invokes involves creating a UIPicker. While the picker is finding the titles, it disables and highlights the button. (It disables the button so that touching it won't cause touchup to fire again, thus automatically ending the highlight.)
     

Share This Page