Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add delete effect like iphone application?

Tags:

animation

ipad

I have to give a delete thumbnail animation in my ipad application just like iphone/ipad applications delete effect. Any body help me please sample photo is attachedenter image description here

If you need more details then kindly mention it in comments

like image 392
Mashhadi Avatar asked Jan 09 '13 07:01

Mashhadi


People also ask

How do I add motions to my iPhone?

Go to Settings > Accessibility > Motion. Turn on or off any of the following controls: Reduce Motion: Reduces the motion of the user interface, including the parallax effect of icons. Auto-Play Message Effects: Allows the Messages app to automatically play full-screen effects.


1 Answers

I have done this using CGAffineTransformMakeRotation. Don't know there is some other better method. But What I have done is my logic you can copy that as it is and you just need to add a delete button on the left top of that view. In the following code I am just animating the thumbnail or any view just like iPad does on its home screen. One thing, You need to declare int direction globally. and every time when you will call this method you will set direction = 1;

    -(void)shakeToDelete:(UIView *)shakeMe
{

    [UIView animateWithDuration:0.1 animations:^
     {
         shakeMe.transform = CGAffineTransformMakeRotation(0.05 * direction);
     }
                     completion:^(BOOL finished)
     {

         direction = direction * -1;
         [self shakeToDelete:shakeMe];
     }];
 }

/// edit I tried this way and got it working in my sample screen as attached in photo enter image description here

like image 73
Umair Aamir Avatar answered Oct 24 '22 12:10

Umair Aamir