Motion Design for IOS (38)

Source: Internet
Author: User
Tags diff

I also used a wave-shaped animation in my own iphone app interesting. Take a look at my app's animations and build it.

Animated interesting stories into Position

When my news app interesting first opened, I would launch a Web request to pull the latest article. When the request returns, I need UITableView to place the article data, one article per line. Some apps choose to fade in the list when the data is returned, and some will slide the row row to position, while others will immediately display the row without any animation. I chose to use a built-in effect like the music player we just built, but not to animate them horizontally, I animated them vertically from the bottom. That's what my loading animations look like.

To finish it, first step by step to break down what I have done.

    1. If the data is returned and I call [Self.tableview Reloaddata], it appears immediately and is visible to the user. So I first make the list transparent to 0 so that I can manipulate it so that the user doesn't see anything until I want them to see it.
    2. I then call [Self.tableview Reloaddata] to load the data into the list row, when all the rows are in their normal position, but because the entire list is 0 transparent and hidden, nothing on the screen is visible.
    3. I traverse the lines that are visible on the screen now and move the UITableView rows to the bottom of the screen. I do this by changing the position of the list and moving it below the height of the entire list so that each row is hidden at the bottom of the screen.
    4. Now that all the rows are at the bottom of the screen, I'm going to change alpha back to 1.0来 so the list becomes visible. The list is now visible, but the rows are all at the bottom of the screen so you don't see any articles.
    5. Finally, I traverse all the rows again to push them off the bottom of the screen and animate them to their original positions by removing the transformations of my initial settings.

This seemingly fairly simple effect has so many steps! Here is the code to complete these steps.

//change list to invisible, reload data Self. TableView. Alpha=0.0F [ Self. TableViewReloaddata];//Store a time variable so that I can adjust the delay time between each line of animationCGFloatdiff =. in;CGFloatTableheight = Self. TableView. Bounds. Size. Height;Nsarray*cells = [ Self. TableViewVisiblecells];//Traverse rows and move them to the bottom of the screen for(Nsuinteger a =0; A < [cells count]; a++) {UITableViewCell*cell = [cells objectatindex:a];if([Cell iskindofclass:[UITableViewCellClass]]) {//move to the bottom of the screen by changing the cell's y-coordinateCell. Transform= Cgaffinetransformmaketranslation (0, tableheight); }}//Now all rows are at the bottom of the screen, set the list to visible Self. TableView. Alpha=1.0F//animate each line back to position for(Nsuinteger B =0; b < [cells count]; b++) {UITableViewCell*cell = [cells objectatindex:b]; [UIViewAnimatewithduration:1.6Delay:diff*b usingspringwithdamping:0.77Initialspringvelocity:0Options0animations:^{cell. Transform= Cgaffinetransformmaketranslation (0,0); } Completion:NULL];}

If you notice the second loop, in the block of the animation, my delay value is set to Diff*b. Because I am in a loop, I can use the loop number variable B synchronously to keep the animation time, just to manipulate the animation interval of each line. This ensures that each line of animation is the same time, to achieve a good wave shape action. That's all!

It's time to shift gears.

At this point, we used the core animation to create our animated interface. Whether we're using the block-based animation method of iOS 7 and its spring properties, or using a great jnwspringanimation framework created for us, CAKeyframeAnimation we're still in the range of core animation, Apple has a multitude of frameworks to manage iOS ' wide range of interface performance.

But there are a number of ways to solve the problem, which means that there are other ways to create actions on the iOS app's screen without using Apple's core animation framework.

One of the ways to create animations has recently gained a lot of attention. It's a clear stream from the iOS animation framework and has been used to build great animations in some of the most popular apps in the world.

What I'm talking about is, of course, the outstanding pop frame created by Facebook.

Are you ready to learn something new? Let's go!

Finished viewing the integration set: Https://github.com/Cloudox/Motion-Design-for-iOS
All rights reserved: Http://blog.csdn.net/cloudox_

Motion Design for IOS (38)

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.