PDA

View Full Version : What's the right event for doing this?




Pulkit
Aug 29, 2008, 02:47 AM
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?

Thanks!



Niiro13
Aug 29, 2008, 03:03 AM
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.

Pulkit
Aug 29, 2008, 04:34 AM
Niiro13,

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!

mccannmarc
Aug 29, 2008, 05:02 AM
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.

Pulkit
Aug 29, 2008, 06:48 AM
Hummm... I guess that's the way to do it for now!