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?
I'd use something like this:
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];
button.center = CGPointMake(x,y);
[UIView commitAnimations];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.