Shake And Delete View for iOS

Shake And Delete View for iOS

Released 6 years ago , Last update 6 years ago

LTShakeAndDeleteView is an UIView that will allow you to shake it (and all its children) just the way the iOS home icons does when you want to delete or move them, adding a delete/remove icon on it to get its action call.

LTShakeAndDeleteView


What is it ?

LTShakeAndDeleteView is an UIView that will allow you to shake it (and all its children) just the way the iOS home icons does when you want to delete or move them.

It allows also to add or remove an icon on the top left or top right position of your UIView to be able to handle that kind of action request.

There's 2 different kind of icons (minus or remove), of two different sizes (24x24 or 32x32) that can be placed at the left or right top position of the view.  How to add it in my project ?

Open your project into xCode, then create a new group named whatever you want, and drag/drop the following files onto it :

LTShakeAndDeleteView.h
LTShakeAndDeleteView.m
btMinus_24x24.png
btMinus_32x32.png
btRemove_24x24.png
btRemove_32x32.png

By doing that, you've added a new UIView style on your project.
Now you're able to shake any UIView and to add on it or not a minus or Remove button able to warm you on a touch.

To do so, add an UIView on your xib and change its class to LTShakeAndDeleteView.

Now create an outlet connector on your .h project by adding it in your declarations :

IBOutlet LTShakeAndDeleteView *view1;
IBOutlet LTShakeAndDeleteView *view2;
IBOutlet LTShakeAndDeleteView *view3;
IBOutlet LTShakeAndDeleteView *view4;

Then connect it through Interface Builder.

Now, you're able to start shaking it or to stop it in this very easy way :

[view1 startShaking];
[view1 stopShaking];

How does the delete button work ?

The delete button can be shown by calling this method :

[view1 showDeleteButtonOfStyle:sdvMinus24 
       toLeftPosition:YES 
       forSelector:@selector(closeButtonTouched:) 
       ofParent:self 
       withTag:1];

The style of the button can be defined by the first parameter of this method. It can be one of the following ENUM values :

sdvMinus24
sdvMinus32
sdvRemove24
sdvRemove32

toLeftPosition can contain YES or NO to tell the method where you want to place the button.

forSelector must point to a selector to a method of your controller that will received the button touch action call.
This must be a void method that is able to receive an (id) sender like this :

- (void)closeButtonTouched:(id)sender

ofParent must be the parent of this selector

withTag is an NSInteger value of your that can be retrieve into your returning method to identify which button of which view has been touched.

To hide the close button, just call :

[view1 hideDeleteButton];

Note that showing or hidding a button is done by using a smooth fade :-)


Method list

- (void)startShaking; 
Tell the component to start shaking the UIView, the optional close button and all childs of this View.

- (void)stopShaking; Well, hem, stop shaking ?

- (void)showDeleteButtonOfStyle:(SDVButtonStyle)style toLeftPosition:(BOOL)leftPosition forSelector:(SEL)selector ofParent:(id)parent withTag:(NSInteger)tag; As explained in the previous chapter, this is the method to be called to set a button style, a position, a returning method and to show it.

- (void)hideDeleteButton; Hide the button, using a smooth fade.

4.5
  • 5 2
  • 4 2
  • 3 0
  • 2 0
  • 1 0
4 Reviews Read Reviews

Pricing

14 day 14-day money-back guarantee

$15.99

Personal License

  • Perpetual license

  • 1 application

  • Can distribute binary products only

  • Commercial use

2 licenses, starting from From » $15.99 View Licenses

Get A Quote

What do you need?
  • Custom development
  • Integration
  • Customization / Reskinning
  • Consultation
When do you need it?
  • Soon
  • Next week
  • Next month
  • Anytime

Thanks for getting in touch!

Your quote details have been received and we'll get back to you soon.


Or enter your name and Email
  • EB Edouard Boily License holderPersonal License
    Purchased on Oct 31, 2011
    6 years ago
    I bought the package anyway and it is working quite well as a parent view. So, to answer my own question, yes you can subclass LTShakeAndDeleteView. The animation is also spot on, replicates quite exactly the OS shaking.
  • EB Edouard Boily License holderPersonal License
    Purchased on Oct 31, 2011
    6 years ago
    I suspect this is possible but I prefer to ask. Can I extend your LTShakeAndDeleteView like, for example,
        @interface MyOwnView : LTShakeAndDeleteView 
    
    So I can implement view reordering through dragging, editing etc. on top of your jiggling and button mechanism. Thanks