UIView AnimationUikit integrates animations directly into the UIView class, and UIView provides animated support for these changes when some of the internal properties change.
The work required to perform the animation is done automatically by the UIView class, but you still want to notify the view when you want to perform the animation, for which you need to place the code that changes the property in [UIView Beginanimations:nil Context:nil] and [UIView Commitanimations] Between
Common method Parsing:
+ (void) Setanimationdelegate: (ID) delegate
Sets the animation proxy object, which sends a message to the proxy object when the animation starts or ends
+ (void) Setanimationwillstartselector: (SEL) Selector
When the animation is about to begin, execute the selector of the delegate object and pass in the Beginanimations:context: the parameters passed into the selector
+ (void) Setanimationdidstopselector: (SEL) Selector
When the animation ends, the selector of the delegate object is executed, and the parameters passed in Beginanimations:context: are passed into the selector
// describes the need to perform animations [UIView Beginanimations:nil context:nil]; // set the duration of an animation [UIView setanimationduration:1]; // Set Transition animations [UIView setanimationtransition:uiviewanimationtransitioncurlup forView:self.view Cache:yes]; // swap the location of a child view [Self.view Exchangesubviewatindex:0 withsubviewatindex:1]; // Submit Animation [UIView commitanimations];
UIView Animation
+ (void) Setanimationduration: (nstimeinterval) Duration//duration of the animation, in seconds+ (void) Setanimationdelay: (nstimeinterval) Delay//animation delays delay seconds before starting+ (void) Setanimationstartdate: (NSDate *) StartDate//start time of the animation, default to now+ (void) Setanimationcurve: (Uiviewanimationcurve) Curve//The rhythm of the animation control, specifically see the following "Remarks"+ (void) Setanimationrepeatcount: (float) RepeatCount//number of repetitions of an animation+ (void) Setanimationrepeatautoreverses: (BOOL) repeatautoreverses//If set to Yes, the effect of each repetition of the animation is the opposite of the previous one+ (void) Setanimationtransition: (uiviewanimationtransition) Transitionforview: (UIView *) View cache: (BOOL) cache
Block animation
+ (void) Animatewithduration: (nstimeinterval) Duration delay: (nstimeinterval) Delay options: (uiviewanimationoptions) Options animations: (void (^) (void)) animations completion: (void (^) (BOOL finished)) completion
Parameter resolution:
Duration: Duration of animation
Delay: Animation delays delay after seconds start
Options: Rhythm Control for animations
Animations: Place code that changes the properties of the view in this block
Completion: This block is automatically called after the animation is finished
+ (void) Transitionwithview: (UIView *) View Duration: (nstimeinterval) Duration options: (uiviewanimationoptions) Options animations: (void (^) (void)) animations completion: (void (^) (BOOL finished)) completion
Parameter resolution:
Duration: Duration of animation
View: Views that require a transition animation
Options: Types of transition animations
Animations: Place code that changes the properties of the view in this block
Completion: This block is automatically called after the animation is finished
+ (void) Transitionfromview: (UIView *) Fromview Toview: (UIView *) Toview Duration: (nstimeinterval) Duration options: ( uiviewanimationoptions) Options Completion: (void (^) (BOOL finished)) completion
After the method call is complete, the following two lines of code are executed:
Add Toview to Parent view
[Fromview.superview Addsubview:toview];
Remove the Fromview from the parent view
[Fromview.superview Removefromsuperview];
Parameter resolution:
Duration: Duration of animation
Options: Types of transition animations
Animations: Place code that changes the properties of the view in this block
Completion: This block is automatically called after the animation is finished
Frame Animations for UiimageviewUiimageview allows a series of images to be displayed sequentially within a given time.
Related attribute parsing:
Animationimages: The picture to be displayed (a nsarray with UIImage).
Animationduration: The time required to fully display all the pictures in the animationimages.
Animationrepeatcount: The number of times the animation was executed (default = 0, which represents an infinite loop)
Related method parsing:
-(void) startanimating; Starts the animation.
-(void) stopanimating; Stops the animation.
-(BOOL) isanimating; Whether the animation is running.
Uiactivityindicatorviewis a rotational progress wheel that can be used to inform the user that an operation is in progress and is normally initialized with Initwithactivityindicatorstyle.
Method parsing:
-(void) startanimating; start animation
-(void) stopanimating; Stop animation
-(BOOL) isanimating; Whether the animation is running
The Uiactivityindicatorviewstyle has 3 values to choose from:
Uiactivityindicatorviewstylewhitelarge//Large white indicator
Uiactivityindicatorviewstylewhite//Standard size white indicator
Uiactivityindicatorviewstylegray//Grey indicator for white background