[UIView beginAnimations:@"suck" context:NULL];
[UIView setAnimationDuration:0.6];
[UIView setAnimationDelegate:self];
[UIView setAnimationPosition:[self convertPoint:CGPointMake(self.closeX, self.closeY) toView:[self superview]]];
[UIView setAnimationTransition:103 forView:self cache:NO];//103 就是suckEffect 的枚举
[UIView setAnimationDidStopSelector:@selector(removeFromSuperview)];
[UIView commitAnimations];
编译的时候出现'UIView' may not respond to '+setAnimationPosition:' 不用理会, 其实setAnimationPosition 是起作用的。
[UIView beginAnimations:@"suckEffect" context:NULL];
[UIView setAnimationTransition:103 forView:view1 cache:YES];//forview后面是要改变的view
[UIView setAnimationDuration:3];
[UIView setAnimationPosition:CGPointMake(400, 200)];// 你要的位置!
[UIView commitAnimations];
CATransition *transition = [CATransition animation];
transition.duration = 1.5f;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionReveal;
transition.subtype = kCATransitionFromTop;
[UIView setAnimationPosition:CGPointMake(400, 200)];
transition.removedOnCompletion = TRUE;
[[view1 layer] addAnimation:transition forKey:nil];
本文详细介绍了如何使用UIView的beginAnimations和commitAnimations方法实现视图的动画位移效果,包括设置动画参数、过渡类型和回调方法。通过实例演示了不同动画效果的应用,适合iOS开发人员学习。
1421

被折叠的 条评论
为什么被折叠?



