Tag Archives: Core Animation

Core Animation Scroll Layer: CAScrollLayer

via Core Animation Scroll Layer: CAScrollLayer.

The CALayer class has many specialized subclasses, such as CAEAGLLayer, CAEmitterLayer, CAGradientLayer, CAReplicatorLayer, CAScrollLayer, CAShapeLayer, CATextLayer, CATransformLayer. Each of these subclasses has been designed for a very specific task. In this tutorial, I will show you how to use a CAScrollLayer.

A CAScrollLayer can be used to display a portion of its sublayers and to animate them. A CAScrollLayer has only a property (scrollMode) and two instance methods (scrollToPoint(_:)and scrollToRect(_:)). Although this class provides only a property and two methods, it is quite powerful, since it allows you to create incredible visual effects and animations that would be very complex to do with a CALayer object.

UIStackView, Auto Layout and Core Animation

via UIStackView Auto Layout Core Animation.

In iOS 9 Apple introduces a new UIStackView, a new class that leverages the power of Auto Layout. UIStackView allows you to lay out a collection of views in either a column or a row without having to add layout constraints to each view.

In this tutorial, I will show you here how to create animations with stack views. In this post on Auto Layout and Core Animation, I have already demonstrated how to animate views that have layout constraints. Remember, when using Auto Layout you are not allowed to modify the view frame. Please, notice that Xcode 6 has a bug that Xcode 7 current build seems to solve. Indeed, if you are using Xcode 6 and try to modify the frame of a view that has layout constraints, the frame changes without a problem (but this should not be possible). In Xcode 7 (as it was previously in Xcode 5), the frame is not modified. This is the correct behavior.

Stack views should behave in the same way. If a view is contained in a stack view and you try to modify the view frame, it should not change. So, how do you animate the frame of a view within a stack view?

When you use a stack view, you are responsible for the layout (position and size) of the stack view in the container. Then, the stack view manages the layout and size of its content. Views contained in the stack view are called arranged views.

Let’s build an example. Launch Xcode 7 and create a Single View Application. Open the Main storyboard and add 2 views to the view controller’s view. Set the size of one of them to 100×100 and the size of the other one to 200×100. Center them vertically in the viewcontroller’s view and make their edges touch as shown in the following picture.

Project 15: Core Animation

via Project 15: Core Animation – Overview – a free Hacking with Swift tutorial.

Brief: Bring your interfaces to life with animation, and meet switch/case at the same time.

Learn: Core Animation, CGAffineTransform.

How To Create a Cool 3D Sidebar Animation Like in Taasky

via How To Create a Cool 3D Sidebar Animation Like in Taasky – Ray Wenderlich.

This tutorial is for the experienced developer; you’ll be working with Auto Layout constraints, UIScrollView, view controller containment, and Core Animation. If this all sounds a bit unfamiliar, then I’d recommend you start with some of our other iOS tutorials before returning to this one!

iOS Podcasts

Good news everyone – we now have an official raywenderlich.com Podcast!

This podcast is focused around topics of interest for app developers and gamers. In each episode, we’ll interview a well-known developer, have some tech talk and non-tech talk, and fill you in on what’s new on the website.

The hosts for this podcast are team members Tammy Coron, Jake Gundersen, Felipe Laso Marsetti, and Mic Pringle. I will be popping in to give the “what’s new on raywenderlich.com” section, but really this is their show :]