View之间切换的动态效果设置:
<wbr><wbr><wbr>SettingsController *settings = [[SettingsController alloc]initWithNibName:@"SettingsView" bundle:nil];<br><wbr><wbr><wbr>settings.modalTransitionStyle = UIModalTransitionStyleFl<wbr>ipHorizontal;<wbr>//水平翻转<br><wbr><wbr><wbr>[self presentModalViewControll<wbr>er:settings animated:YES];<br><wbr><wbr><wbr>[settings release];</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
- (IBAction) activate:(UIView*)view
{
CGContextRef context = UIGraphicsGetCurrentContext();
[UIView beginAnimations:nilcontext:context];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:CONST_animation_time];
[view setCenter:UpPointOfView(view)];
CABasicAnimation *scalingAnimation = (CABasicAnimation *)[view.layeranimationForKey:@"scaling"];
if (!scalingAnimation)
{
scalingAnimation = [CABasicAnimationanimationWithKeyPath:@"transform"];
scalingAnimation.repeatCount=1;
scalingAnimation.duration=CONST_animation_time;
scalingAnimation.autoreverses=NO;
scalingAnimation.timingFunction = [CAMediaTimingFunctionfunctionWithName:kCAMediaTimingFunctionEaseOut];
scalingAnimation.fromValue=[NSValuevalueWithCATransform3D:CATransform3DMakeScale(1.0,1.0, 1.0)];
scalingAnimation.toValue=[NSValuevalueWithCATransform3D:CATransform3DMakeScale(CONST_enlarge_proportion,CONST_enlarge_proportion, 1.0)];
}
[view.layer addAnimation:scalingAnimationforKey:@"scaling"];
view.layer.transform =CATransform3DMakeScale(CONST_enlarge_proportion,CONST_enlarge_proportion, 1.0);
[UIView commitAnimations];
}
- (IBAction) deactivate:(UIView*)view
{
CGContextRef context = UIGraphicsGetCurrentContext();
[UIView beginAnimations:nilcontext:context];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:CONST_animation_time];
[view setCenter:DownPointOfView(view)];
CABasicAnimation *scalingAnimation = (CABasicAnimation *)[view.layeranimationForKey:@"descaling"];
if (!scalingAnimation)
{
scalingAnimation = [CABasicAnimationanimationWithKeyPath:@"transform"];
scalingAnimation.repeatCount=1;
scalingAnimation.duration=CONST_animation_time;
scalingAnimation.autoreverses=NO;
scalingAnimation.timingFunction = [CAMediaTimingFunctionfunctionWithName:kCAMediaTimingFunctionEaseOut];
scalingAnimation.fromValue=[NSValuevalueWithCATransform3D:CATransform3DMakeScale(CONST_enlarge_proportion,CONST_enlarge_proportion, 1.0)];
scalingAnimation.toValue=[NSValuevalueWithCATransform3D:CATransform3DMakeScale(1.0,1.0, 1.0)];
}
[view.layer addAnimation:scalingAnimationforKey:@"descaling"];
view.layer.transform =CATransform3DMakeScale(1.0,1.0, 1.0);
[UIView commitAnimations];
}