قالب وردپرس درنا توس
Home / IOS Development / Interactive View Animations in IOS

Interactive View Animations in IOS



On the last WWDC, Apple introduced a new API for creating interactive animations in IOS 10. In this post, I will show you how to use this new API and build a new type of animation, where the user can pause and scrub the animation and interact with the animated object.

The main class of this new API is UIViewPropertyAnimator . This class lets you animate views from start to finish as you would normally do with the old animation API UIView . Additionally, UIViewPropertyAnimation allows you to interact with the animated object and pause and restart the animations. UIViewPropertyAnimator class adopts two protocols: UIViewAnimating and UIViewImplicitlyAnimating . These protocols add more features to the main class. Let's start using the class UIViewPropertyAnimator and build a very simple animation.

Basic Animation

You will find the new UIViewPropertyAnimator class well known, as it provides a way to build animations using shutdowns (or blocks) in the same way as in the current viewing animation API.

Let's start Xcode 8 and create a new project. Name it Animations . In ViewController.swift, let's add a view programmatically: