[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];