Help with making a button

Discussion in 'iOS Programming' started by MrPenguin9, Nov 20, 2008.

  1. MrPenguin9
    Expand Collapse
    macrumors member

    Joined:
    Aug 1, 2008
    #1
    How do you tell it during the button is held down do this, and when you let go of the button do this?

    Thanks so much
     
  2. jnic
    Expand Collapse
    macrumors 6502a

    Joined:
    Oct 24, 2008
    Location:
    Cambridge
    #2
    In Interface Builder add a couple of IBActions for (respectively) Touch Down and Touch Up Inside.
     
  3. Niiro13
    Expand Collapse
    macrumors 68000

    Joined:
    Feb 12, 2008
    Location:
    Illinois
    #3
    And if you want to do it programatically, then you'd go

    Code:
    [myButton addTarget:self action:@selector(touchDownAction:) forControlEvents:UIControlEventTouchDown];
    [myButton addTarget:self action:@selector(touchUpAction:) forControlEvents:UIControlEventTouchUpInside];
     
  4. MrPenguin9
    Expand Collapse
    thread starter macrumors member

    Joined:
    Aug 1, 2008

Share This Page