Override Highlighted for UIButton?

Discussion in 'iOS Programming' started by ArtOfWarfare, Dec 9, 2009.

  1. ArtOfWarfare macrumors G3


    Nov 26, 2007
    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. Darkroom Guest


    Dec 15, 2006
    Montréal, Canada
    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. ArtOfWarfare thread starter macrumors G3


    Nov 26, 2007
    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