- Core Animations
Allows the view to rotate, scale, and pan (primarily the layer property of the view) but the location of the core animation is not the real position, and everything is false. So sometimes you need to use other animations, like UIView originally encapsulated animations, and timers
// achieve 360° rotation of pictures cabasicanimation* rotationanimation; = [Cabasicanimation Animationwithkeypath:@ "transform.rotation.z"]; 2.0 ]; = duration; = YES; = repeat; [View.layer addanimation:rotationanimation Forkey: @" rotationanimation "];
- timer
Cadisplaylink calls 60 times per second
/ / create timer cadisplaylink *link = [ Cadisplaylink displaylinkwithtarget:self selector: @selector (XXX)]; // Join the run loop [link addtorunloop: [Nsrunloop Mainrunloop] formode:nsdefaultrunloopmode]; // Implement the XXX method -(void ) xxx{ // Animation method } * * * When using the button click (or other events) to enable the timer, to lazy load timer, or continuous click on the button, the timer will accumulate.
Timer has a stopped property
Link.pause = NO;//Timer end
Link.pause = YES;//Timer stop
- There are two methods of loading Xib
// 1. This should be used when there is no connection with storyboard -(ID) Initwithcoder: (Nscoder *) adecoder{}//2. This is used with the storyboard connection -(void) awakefromnib{} Otherwise, the properties in the view class cannot be taken
- Crop a picture
// a piece of footage with multiple images to trim, then use the core animation for UI layout // To trim the image method, the first parameter passes the image.cgimage to be clipped, the second parameter passes the dimension here to see if the picture is a pixel. Cgimagecreatwithiamgeinrect (,);
iOS Development-Core animation essays