tags:

views:

23

answers:

3

i can pop up png with some animation but how to shrink same imgae when touch us finished??? right now iam doing this

[UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1.5];


    [self.pieView removeFromSuperview];
    [UIView commitAnimations];

but it just remove the image directly

A: 

I am beginner to iPhone. I dont know about animation. But if you use Sprite then you can shrink an image easily using its scale property.

Sadat
+1  A: 

-removeFromSuperview is not an animatable property--it's a method that makes the view disappear. You want to actually instruct the view on how it should animate by manipulating properties on the view such as alpha or transform.

To ensure the view is actually removed from the view hierarchy when the animation is complete, you can use +[UIView setAnimationDidStopSelector:] and +[UIView setAnimationDelegate:]. If you're only targetting iOS 4 and later, you can use two blocks and have much simpler code:

[UIView animateWithDuration: 1.0
    animations: ^ {
        /* This code is animated. */
        view.alpha = 0.0;
        view.transform = CGAffineTransformMakeScale(0.1, 0.1);
    }
    completion: ^ (BOOL finished) {
        /* This code is run after the animation stops. */
        [view removeFromSuperview];
    }
];
Jonathan Grynspan
i am using 3.0 now how i want my image to shrink i the same way as it pop up
ram
i did it thanks pieView.frame = CGRectMake(g.x , g.y , 0.0,0.0);
ram
A: 

well to shirnk i did pieView.frame = CGRectMake(g.x , g.y , 0.0,0.0);

ram