What's the right event for doing this?

Discussion in 'iOS Programming' started by Pulkit, Aug 29, 2008.

  1. Pulkit macrumors newbie

    Aug 27, 2008
    Hi Guys,

    I am sure you must have tried deleting an icon from the iPhone desktop.

    It goes like this, when you want to delete something from iPhone desktop you press and hold the any icon on the desktop and you see a "cross" image on each item on the desktop and then you click that "cross" image and an Alert popsup asking you if you are interested in deleting that item or not.

    I want to implement exactly same functionality in my app. please suggest how can I do that? What event should I use for this purpose?

  2. Niiro13 macrumors 68000

    Feb 12, 2008
    It's automatic. There's nothing you need to implement.

    It works for any App Store applications.

    This is because if Apple does not put this in automatically, then there is no other way to uninstall applications (aside from connecting to the computer).

    EDIT: Re-read your post.

    If you meant being able to tap and hold something, then have a button appear then pop up...

    Well you'd read the documentation on the Touch commands (don't use them in my application, so can't help you there). Then you'd add a button to the view. Set the button to display a UIAlertView when TouchUpInside. After that, you simply clear whatever you were trying to delete.
  3. Pulkit thread starter macrumors newbie

    Aug 27, 2008

    I understand that Apple provide that functionality to un-install the applications. All I want is that suppose if I have a UIButton on my view. I want to provide an option where user can press and hold the button after that a "cross" image will appear on the top left corner of the UIButton and click on that cross image will bring my UIALertView with options.

    So, I am now looking for a mechanism where I can provide pressing and holding on a UIButton. If I use any Touch event here then all it can do is provide single click, double click, drag and drop. And that is not what I want.

    Hopes this make sense!
  4. mccannmarc macrumors 6502


    Aug 15, 2008
    Manchester, UK
    I've never needed to do anything like this but I would try to use the TouchesBegan method of the button to get a timer going which checks how long the user has had their finger on a certain part of the screen. When the timer reaches a certain point, e.g. 3 seconds then draw your cross view over the uibutton. Make it so when the cross view is pressed it pops up your menu, or when another portion of the screen is pressed it gets rid of the cross view and redraws the button as normal.
  5. Pulkit thread starter macrumors newbie

    Aug 27, 2008
    Hummm... I guess that's the way to do it for now!

Share This Page