iOS開発-a few animation Effect

2199 ワード

You can use animation optimize your App. So how do you use it?Hear I will use some simple demo examples to explain.
 
CATransition Class
CATransition *animation = [CATransition animation];
[animation setDuration:1.0];
[animation setType:kCATransitionFade]; // use define flag
[animation setType:@"oglFlip"]; // use string flag
[animation setSubtype:kCATransitionFromLeft]; // can use to cooperate with type
[self.imageView.layer addAnimation:animation forKey:nil];

Common Transition Types:

kCATransitionFade
kCATransitionMoveIn
kCATransitionPush
kCATransitionReveal

Common Transition Subtypes:

kCATransitionFromRight
kCATransitionFromLeft
kCATransitionFromTop
kCATransitionFromBottom

 Type is can use these string flag. but dont use it!
@“cameraIris”
@“cameraIrisHollowOpen”
@“cameraIrisHollowClose”
@“cube”
@“alignedCube”
@“flip”
@“alignedFlip”
@“oglFlip”
@“rotate”
@“pageCurl”
@“pageUnCurl”
@“rippleEffect”
@“suckEffect”

 Beacase is :
most of the ones you've listed a private, and not supported. You can probably get away with using them because the automated code checking Apple does doesn't check for transition type strings, but if a human reviewer figures out what you are doing then your app will be rejected. Apple only lists kCATransitionFade, kCATransitionMoveIn, kCATransitionPush and kCATransitionReveal in the docs, so those are the only officially supported ones. ———— by Duncan C