tags:

views:

724

answers:

1

how to make a UIButton when moving (animated) without shadow? i tried the code but cannot make it can someone modifify or point out the problem

-(IBAction)move{

point=CGPointMake(0,1);
for(int i=0;i<50;i++){
 NSLog(@"fdfafa");



 CATransition *animation = [CATransition animation];
 [animation setType:@"push"];
 [animation setSubtype:@"fromBottom"];
 [animation setDuration:0.5];
 //[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];

 [testButton.layer addAnimation:animation forKey:kAnimationKey];

 testButton.center = CGPointMake(testButton.center.x, testButton.center.y + point.y);

   }
NSLog(@"%f",testButton.center.y);

}

or have other better method to make a object move animated?

+1  A: 

I'd use something like this:

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];
button.center = CGPointMake(x,y);
[UIView commitAnimations];
drvdijk
this is for UIView but not UIButton,how about UIButton
sorry i read wrongly got it thanks
Thos are class methods to UIView :)
drvdijk