(Original) enumeration in IOS Animation: UIViewAnimationOptions and ios Enumeration

Source: Internet
Author: User

(Original) enumeration in IOS Animation: UIViewAnimationOptions and ios Enumeration

If this post is transferred out of "blog Garden", please indicate the source (blog garden · xiaobaoinvestigate ):Http://www.cnblogs.com/xiaobajiu/p/4084747.html

Poor things that tianchao cannot find at present are easy for beginners to learn.

First, this enumeration belongs to UIViewAnimation. Our frequently used functions are [UIView animateWithDuration: animations: ^ {} completion: ^ (BOOL finished) {}]; and [UIView animateWithDuration: animations: ^ {}]; this function may be used if the animation is a little complex, such as a combination:[UIView animateWithDuration: delay: options: animations: completion: ^ (BOOLFinished) {}];When I first came into contact with a bunch of friends, I may feel bored when I saw a bunch of enumeration, especially the chaotic animation frames of apple. Quartz2D, core animation, and smelly so ...... It doesn't matter. Pick it up and wear it.

In the above methodOptionsYou need to input an enumeration item. This enumeration roughly controls these elements: the speed of animation execution in the current animation nesting period (Fast first, slow later, etc ..). Should the animation be repeated all the time. If I use a transfer animation, what kind of transfer effect do I use. There are also sub-Animations nested in the parent animation, how we treat the same options in the parent animation, and so on ..

 Body:

UIViewAnimationOptionLayoutSubviews // when the animation is submitted, the Child control is laid out, indicating that the child control will be animated together with the parent control.

UIViewAnimationOptionAllowUserInteraction // allows users to communicate with each other during animation, such as touch

UIViewAnimationOptionBeginFromCurrentState // animation starts from the current State

UIViewAnimationOptionRepeat // infinite animation repetition

UIViewAnimationOptionAutoreverse // executes the animation loop, provided that the animation is set to be infinitely repeated.

UIViewAnimationOptionOverrideInheritedDuration // ignore execution time of nested outer Animation

UIViewAnimationOptionOverrideInheritedCurve // ignore the time variation curve of the nested outer Animation

UIViewAnimationOptionAllowAnimatedContent // The animation effect is achieved by modifying attributes and repainting. If the key is not submitted, a snapshot is used.

UIViewAnimationOptionShowHideTransitionViews // use the explicit/hidden method to replace the animation effect of removing layers.

UIViewAnimationOptionOverrideInheritedOptions // ignore nested inheritance options

// Time function curve correlation

UIViewAnimationOptionCurveEaseInOut // time curve function, from slow to fast

UIViewAnimationOptionCurveEaseIn // time curve function, from slow to extremely fast

UIViewAnimationOptionCurveEaseOut // time curve function, from fast to slow

UIViewAnimationOptionCurveLinear // time curve function, constant speed

// Transfer Animation

UIViewAnimationOptionTransitionNone // No transfer Animation

UIViewAnimationOptionTransitionFlipFromLeft // switch from left

UIViewAnimationOptionTransitionFlipFromRight // flip the field from the right

UIViewAnimationOptionTransitionCurlUp // volume transfer

UIViewAnimationOptionTransitionCurlDown // transfer to the next volume

UIViewAnimationOptionTransitionCrossDissolve // transfer crossover disappears

UIViewAnimationOptionTransitionFlipFromTop // flipped from top

UIViewAnimationOptionTransitionFlipFromBottom // switch from bottom to bottom

The above is a brief understanding,WelcomeA friend has a better correction to avoid mistakes.

 

Supplement: the last set of transition animation is generally used in this method:

[UIView transitionFromView: toView: duration: options: completion: ^ (BOOLFinished) {}];

The effect of this method is to insert a view to remove one view, during which some transition animation effects can be used.

 


In ios, how does one determine whether an input parameter belongs to an enumeration member?

Enumeration is essentially an immutable integer. There is no way to judge unless you replace the input parameter with the enumeration type, so that the compiler can judge the type.

Arrays in ios and several common enumeration methods for dictionary collection departments and Classes

NSMutableArray * array = [[NSMutableArray alloc] initWithObjects: @ apple, @ AB, @ aa, @ aac, @ appd, nil]; // sort [array sortUsingComparator: ^ NSComparisonResult (_ strong id obj1 ,__ strong id obj2 ){
NSString * str1 = (NSString *) obj1;
NSString * str2 = (NSString *) obj2;
Return [str1 compare: str2] ;}]; NSLog (@ array =%@, array); // enumerated dictionary NSNumber * age = [NSNumber numberWithInt: 51];
NSDictionary * dic = [[NSDictionary alloc] initWithObjectsAndKeys: @ Anthony, @ FirstName, @ Robbins, @ LastName, age, @ age, nil];
[Dic enumerateKeysAndObjectsUsingBlock: ^ (_ strong id key ,__ strong id value, BOOL * stop ){
NSLog (@ Key =%@, Value For Key =%@, key, value) ;}]; // method 2 NSEnumerator * keys = [dic keyEnumerator];
Id keyInDic = nil;
While (keyInDic = [keys nextObject])! = Nil ){
Id valueForKey = [dic objectForKey: keyInDic];
NSLog (@ Key =%@, ValueForKey =%@, keyInDic, valueForKey);} // NSSetNSString * hisName = @ li;
NSString * hisLastname = @ san;
NSString * herName = @ zhang;
NSString * herLastname = @ san;
NSMutableSet * set = [[NSMutableSet alloc] initWithObjects: hisName, hisLastname, herName, herLastname, nil];
NSLog (@ % @, set); // delete an object [set removeObject: herLastname];
NSLog (@ % @, set); // Add [set addObject: hisLastname];
NSLog (@ % @, set );
[Set addObjectsFromArray: array];
NSLog (@ % @, set); // traverses set [set enumerateObjectsUsingBlock: ^ (_ strong id objc1, BOOL * stop ){
If ([objc1 isKindOfClass: [NSString class]) {
NSString * str = (NSString *) objc1;
If ([str isEqualToString: @ san1]) {
NSLog (@ find san in set); * stop = YES ;}}];
// Set anyObject... the remaining full text>

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.