tableview 扇页动画
CATransform3Drotation;
rotation =CATransform3DMakeRotation( (90.0*M_PI)/180,0.0,0.7,0.4);
rotation.m34=1.0/ -600;
cell.layer.shadowColor= [[UIColorblackColor]CGColor];
cell.layer.shadowOffset=CGSizeMake(10,10);
cell.alpha=0;
cell.layer.transform= rotation;
cell.layer.anchorPoint=CGPointMake(0,0.5);
[UIViewbeginAnimations:@"rotation"context:NULL];
[UIViewsetAnimationDuration:0.8];
cell.layer.transform=CATransform3DIdentity;
cell.alpha=1;
cell.layer.shadowOffset=CGSizeMake(0,0);
[UIViewcommitAnimations];
tableview偏移动画
cell.alpha=0.5;
CGAffineTransformtransformScale =CGAffineTransformMakeScale(0.3,0.8);
CGAffineTransformtransformTranslate =CGAffineTransformMakeTranslation(0.5,0.6);
cell.transform=CGAffineTransformConcat(transformScale, transformTranslate);
[tableViewbringSubviewToFront:cell];
[UIViewanimateWithDuration:.4f
delay:0
options:UIViewAnimationOptionAllowUserInteraction
animations:^{
cell.alpha=1;
//清空transform
cell.transform=CGAffineTransformIdentity;
}completion:nil];
按钮点击动画
//点击动画
[UIViewbeginAnimations:nilcontext:nil];
[UIViewsetAnimationDuration:0.20];
[UIViewsetAnimationDelegate:self];
// slideBg.frame = btn.frame;
[UIViewcommitAnimations];
CAKeyframeAnimation* animation;
animation = [CAKeyframeAnimationanimationWithKeyPath:@"transform"];
animation.duration=0.5;
animation.delegate=self;
animation.removedOnCompletion=YES;
animation.fillMode=kCAFillModeForwards;
NSMutableArray*values = [NSMutableArrayarray];
[valuesaddObject:[NSValuevalueWithCATransform3D:CATransform3DMakeScale(1.0,1.0,1.0)]];
[valuesaddObject:[NSValuevalueWithCATransform3D:CATransform3DMakeScale(1.2,1.2,1.0)]];
//[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.5, 1.5, 0.9)]];
[valuesaddObject:[NSValuevalueWithCATransform3D:CATransform3DMakeScale(1.0,1.0,1.0)]];
animation.values= values;
[按钮.layeraddAnimation:animationforKey:nil];
tableview点击某一行放大cell高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if(该indexPath被选中) {
return 60 * 2.0;
}
return 60;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:TRUE];
//获取当前indexPath并判断对应的Cell是否被选中
//最神奇的地方!!
[tableView beginUpdates];
[tableView endUpdates];
}
网友评论