NSButton Subclass

Discussion in 'Mac Programming' started by MacRumoron, May 6, 2006.

  1. macrumors 6502

    Sep 6, 2005
    Lets say I have two images named ButtonUp and ButtonDown..

    How would I subclass NSButton so that it uses the ButtonUp image when not pressed.. and shows the ButtonDown image when pressed?

    Thanks in advance if anyone can help :)
  2. Guest


    Feb 17, 2003
    Hitchin, Herts, UK
    Do you actually need to subclass. Can't you actually do this all in IB? I've not needed to do this buy my first guess would be use a rounded bevel button, change it's behavoir to Push On/Push Off and mess about with Icon and Alt. Icon in the inspector

    Of course as I've never done this I could be totally wrong....:rolleyes:
  3. thread starter macrumors 6502

    Sep 6, 2005
    that didn't work :(

    it doesn't use the alt. image when you push down

    thanks anyway...

    anyone else know?
  4. macrumors 6502a

    Jun 17, 2003
    Just did it. Set one image as the Icon, the second image as the Alt Icon, set the button behavior as "toggle". Where is the problem?
  5. thread starter macrumors 6502

    Sep 6, 2005
    hmm... ok it works now..lol thanks guys

    i had it set to "Momentary Push In" and it should be "Momentary Change" for it to use the alt. icon...

    Thanks for the help ;)

Share This Page