Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Pulkit

macrumors newbie
Original poster
Aug 27, 2008
25
0
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

macrumors 68000
Feb 12, 2008
1,719
0
Illinois
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

macrumors newbie
Original poster
Aug 27, 2008
25
0
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

macrumors 6502
Aug 15, 2008
270
0
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.