From the course: Advanced iOS App Development: Core Animation

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Using custom transactions

Using custom transactions - iOS Tutorial

From the course: Advanced iOS App Development: Core Animation

Start my 1-month free trial

Using custom transactions

- [Instructor] We've seen how animations have been driven by actions behind the scenes, but we haven't touched on how they're actually grouped together and executed. The big picture idea here is that every time a layer is changed in any way, Core Animation automatically creates what's called a transaction to manage it. For the most part, this is perfectly fine letting Core Animation do its work, but occasionally you need to be in complete control. This is where creating your own custom transactions comes in. Let's go to the bottom of our file underneath create text layer. And declare ourselves a new function. Create custom transaction. To start out a transaction, very simple. We'll say CATransaction.begin. To end it, we'll say CATransaction.commit. It's really that simple. All changes we wanna make go in between these two statements. It's a good idea to note here that transactions can be nested within one another. Just be sure you've got beginnings and endings for each one. You don't…

Contents