How can I detect press and hold on the button and drag and drop

Discussion in 'iPhone/iPad Programming' started by DeathscytheSeph, Apr 27, 2009.

  1. macrumors newbie

    Joined:
    Jul 9, 2007
    #1
    Now I working on the iphone app and I have 2 question on the ui
    1: how can i detect the press and hold on button like apple use on the icon to activate the arrange mode
    2: how can i detect the drag and drop on the ui interface eg. i press the table view element and drag my finger on the button to do something other than just press on the table view element

    any suggestion thank you^^
     
  2. macrumors 6502a

    Joined:
    Oct 24, 2008
    Location:
    Cambridge
    #2
  3. thread starter macrumors newbie

    Joined:
    Jul 9, 2007
    #3
  4. macrumors 6502a

    Joined:
    Oct 24, 2008
    Location:
    Cambridge
    #4
    We're not here to write your app for you.

    1. Start a timer on touch down to perform an action after n seconds, and invalidate it on touch up.
    2. All the touches methods give you an set of touches to work with, just record the touch down position and calculate the delta in touches moved.
     
  5. thread starter macrumors newbie

    Joined:
    Jul 9, 2007
    #5
    I know and sorry if i make you upset but I just curious that if I just hold the touch but not move the finger does the touchMove is invoked or not???
     
  6. macrumors 68000

    Joined:
    Feb 12, 2008
    Location:
    Illinois
    #6
    touchesMoved only calls when you move your finger. So if you just touch and don't move, then only touchesBegin is called. Start moving about an inch and like ten or so touchesMoved gets called. Then lift your finger up touchesEnded is called.

    touchesMoved is actually called every few pixels you move and not just once if you move it once. So it's not touchesBegin, move an inch touchesMoved, touches Ended. It's more like touchesBegin, move an inch touchesMoved touchesMoved touchesMoved touchesMoved, touchesEnded.

    Just so you know how it works ;)
     
  7. thread starter macrumors newbie

    Joined:
    Jul 9, 2007
    #7
    Thank you all of you :)
     

Share This Page