Analysis of animation attributes in UIView of iPhone development applications

Source: Internet
Author: User

IPhoneApplication DevelopmentUIViewMediumAnimationAttribute analysis is the content to be introduced in this article, mainly to explainIphoneMediumAnimationFrom which we can learn in detailAnimationFor details, see the attribute of each value in.

AreAnimationsEnabled

Returns a Boolean value indicating whether the animation ends.

 
 
  1. + (BOOL)areAnimationsEnabled 

Return Value

If the animation ends, YES is returned; otherwise, NO is returned.

BeginAnimations: context:

Start an animation Block

 
 
  1. + (void)beginAnimations:(NSString *)animationID context:(void *)context 

Parameters

AnimationID

The internal application identifier of the animation block is used to pass the message to the animation proxy-This selector is set using setAnimationWillStartSelector: And setAnimationDidStopSelector.

Context

The additional application information is used to pass the message to the animation proxy-This selector uses setAnimationWillStartSelector: And setAnimationDidStopSelector: method.

Discussion

This value is changed because some attributes that need to be generated in the animation block are set. Animation blocks can be nested. If it is not called in an animation block, the setAnimation class method will do nothing. Use beginAnimations: context: to start an animation block and use the commitAnimations class method to end an animation block. End an animation block and start when it is outside the animation block.

 
 
  1. + (void)commitAnimations 

If the current animation block is the outermost animation block, the animation block starts when the application returns to the loop. All applications of an animation in an independent thread will not be interrupted. With this method, multiple animations can be implemented. View the setAnimationBeginsFromCurrentState: to learn if an animation starts when another animation is playing.

LayerClass

The returned class is used to create a layer instance object of this class.

 
 
  1. + (Class)layerClass 

Return Value

A class override subclass used to create a view layer to specify a custom class for display. Called when creating a view layer. The default value is a CALayer class object. Alibaba Cloud Studio

SetAnimationBeginsFromCurrentState

Set the animation to start playing from the current status.

 
 
  1. + (void)setAnimationBeginsFromCurrentState:(BOOL)fromCurrentState 

Parameters

FromCurrentState

YES if the animation needs to be played from their current status. Otherwise, it is NO.

Discussion

If it is set to YES, when the animation is running, the current view position will be used as the starting state of the new animation. If it is set to NO, the new animation uses the position of the last state of the view as the start state before the current animation ends. This method will not do anything if the animation is not running or not called outside the animation block. Use beginAnimations: context: Class Method to start and use the commitAnimations class method to end the animation block. The default value is NO.

SetAnimationCurve:

Set the curve of the animation attribute change in the animation block.

 
 
  1. + (void)setAnimationCurve:(UIViewAnimationCurve)curve 

Discussion

The animation curve is the relative speed during the animation operation. This method will be invalid if it is called outside the animation block. Use beginAnimations: context: Class Method to start an animation block and use commitAnimations to end the animation block. The default animation curve value is UIViewAnimationCurveEaseInOut.

SetAnimationDelay:

Set the animation delay attribute in seconds in the animation block)

 
 
  1. + (void)setAnimationDelay:(NSTimeInterval)delay 

Discussion

This method is invalid when it is called outside the animation block. Use beginAnimations: context: Class Method to start an animation block and use the commitAnimations class method to end the animation block. The default animation delay is 0.0 seconds.

SetAnimationDelegate:

Sets the animation message proxy.

 
 
  1. + (void)setAnimationDelegate:(id)delegate 

Parameters

Delegate

You can use setAnimationWillStartSelector: And setAnimationDidStopSelector: to set the object for receiving proxy messages.

Discussion

This method has no effect on the animation block. Use beginAnimations: context: Class Method to start an animation block and use the commitAnimations class method to end an animation block. The default value is nil.

SetAnimationDidStopSelector:

Set the message to the animation proxy when the animation is stopped.

 
 
  1. + (void)setAnimationDidStopSelector:(SEL)selector 

Parameters

Selector

Send the animation to the animation proxy when the animation ends. The default value is NULL. The selector must have the signature of the following method: animationFinished :( NSString *) animationID finished :( BOOL) finished context :( void *) context.

AnimationID

The identifier provided by an application. Same as beginAnimations: context. This parameter can be blank.

Finished

If the animation is completed before it is stopped, YES is returned; otherwise, NO is returned.

Context

An optional application content provider. Same as beginAnimations: context: method. It can be null. This article is from Alibaba Cloud daily online

Discussion

This method has no effect on the animation block. Use beginAnimations: context: Class Method to start an animation block and end with the commitAnimations class method. The default value is NULL.

SetAnimationDuration:

Sets the animation duration in seconds in the animation block)

 
 
  1. + (void)setAnimationDuration:(NSTimeInterval)duration 

Parameters

Duration

The duration of an animation.

Discussion

This method has no effect on the animation block. Use beginAnimations: context: Class Method to start an animation block and use the commitAnimations class method to end an animation block. The default value is 0.2.

SetAnimationRepeatAutoreverses:

Set whether the animation effect in the animation block is automatically replayed.

 
 
  1. + (void)setAnimationRepeatAutoreverses:(BOOL)repeatAutoreverses 

Parameters

RepeatAutoreverses

If the animation is automatically repeated, YES is used; otherwise, NO is used.

Discussion

Auto-repeat indicates that the animation starts playing again after the playback ends. Use setAnimationRepeatCount: Class Method to specify the automatic animation replay time. If the number of duplicates is 0 or outside the animation block, there will be no effect. Use beginAnimations: context: Class Method to start an animation block and use the commitAnimations method to end an animation block. The default value is NO.

SetAnimationRepeatCount:

Set the number of repetitions of an animation in the animation module.

 
 
  1. + (void)setAnimationRepeatCount:(float)repeatCount 

Parameters

RepeatCount

Number of animation repetitions. This value can be a score.

Discussion

This attribute has no effect on the animation block. Use beginAnimations: context: Class Method to start an animation block and end with the commitAnimations class method. The default animation does not rotate. Lyttzx.com

SetAnimationsEnabled:

Set whether to activate the animation

 
 
  1. + (void)setAnimationsEnabled:(BOOL)enabled 

Parameters

Enabled

If YES, activate the animation; otherwise, NO.

Discussion

When the animation parameter is not activated, the animation attribute changes will be ignored. The animation is activated by default.

SetAnimationStartDate:

Set the start time of the animation attribute change within the animation block.

 
 
  1. + (void)setAnimationStartDate:(NSDate *)startTime 

Parameters

StartTime

Start time of an animation

Discussion

Use beginAnimations: context: Class Method to start an animation block and use the commitAnimations class method to end the animation block. The default start time value is returned by the CFAbsoluteTimeGetCurrent method.

SetAnimationTransition: forView: cache:

Set transition for the view in the animation Block

 
 
  1. + (void)setAnimationTransition:(UIViewAnimationTransition)transition forView:(UIView *)view cache:(BOOL)cache 

Parameters

Transition

Apply a transition effect to the view. Possible values are defined in UIViewAnimationTransition.

View

View object to be transitioned.

Cache

If YES, rendering the Image view at the beginning and end and creating frames in the animation; otherwise, the view is rendered at each frame. For example, you do not need to update the view continuously during the view transition. You only need to wait until the conversion is complete before updating the view.

Discussion

If you want to change the appearance of a view during the transformation process. For example, the file uses the container view of a UIView subclass from one view to another, as shown below:

 
 
  1. Begin an animation block.  
  2.  
  3. Set the transition on the container view.  
  4.  
  5. Remove the subview from the container view.  
  6.  
  7. Add the new subview to the container view.  
  8.  
  9. Commit the animation block. 

1. Start an animation block. 2. Set the conversion in the container view. 3. Remove the child view from the container view. 4. Add a sub-View to the container view. 5. End the animation block.

SetAnimationWillStartSelector:

Send a message to the animation proxy when the animation starts.

 
 
  1. + (void)setAnimationWillStartSelector:(SEL)selector 

Parameters

Selector

Send messages to the animation agent before the animation starts. The default value is NULL. This selector must have the same parameters as beginAnimations: context: method, an optional program identifier and content. All these parameters can be nil.

Discussion

This method isAnimationBlock does not have any effect. Use beginAnimations: context: Class Method to startAnimationBlock and end with the commitAnimations class method.

Summary:IPhoneApplication DevelopmentUIViewMediumAnimationThe property analysis is complete. I hope this article will help you!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.