Questions tagged [catransaction]

CATransaction allows you to make batch updates to the Core Animation render tree, and it also allows to trigger implicit animations just by setting layer properties inside of a CATransaction.

CATransaction allows you to make batch updates to the Core Animation render tree. It is most used to override default animation timing functions, durations, etc. or to add a completion block to an animation that doesn't expose one explicitly.

CATransaction allows to trigger implicit animations just by setting layer properties inside of a transaction block. Animating the position of a layer in Objective C:

[CATransaction begin];
[CATransaction setAnimationDuration:0.5];
layer.position = newPosition;
[CATransaction commit];

or the same in Swift:

CATransaction.begin()
CATransaction.setAnimationDuration(0.5)
layer.position = newPosition
CATransaction.commit()

For more information, see the Apple Documentation for CATransaction.

76 questions
2
votes
0 answers

How to properly animate sequentially using CAAnimation

I'm simply closing doors, delaying 2 sec/calling a method then opening them back. One comes from the left side and the other from the right side. I first used UIView animation block but then realized whenever user leaves the app during animation,…
2
votes
1 answer

Move and Rotate GMSMarker smoothly along last updated GPS coordinates Swift iOS

I'm using GMSMapView. So I added custom GMSMarker and set the image(Ex. Bike image) and animating that marker when user starts moving and changing the angle of the marker in locationManager . Currently I'm just updating position attribute of…
Subhodip
  • 63
  • 1
  • 10
2
votes
1 answer

CABasicAnimation not working all the time

I have the following code that is supposed to give the effect of the view "shaking" and then dismissing it by sliding up off of the screen. Sometimes it presents perfectly, but most of the time the shake animation will not display and the view will…
user2284295
2
votes
1 answer

CATransaction insertRowsAtIndexPaths, animation doesn't end

Our app has a tableview that allows users to minimize/maximize its sections. There are also animations tied to hiding/showing rows depending on the user's input, as well as being connected to different devices (via Bluetooth 4.0). Because of the…
weezma2004
  • 203
  • 2
  • 12
2
votes
2 answers

What is the best way to wait for a loop of UIView animations to finish?

I'm trying to loop over multiple UIViews and perform animation on each, but I'd like to know when all of the animations have finished. What is the best way to call a function when the loop of animations has finished? Alternately, is there a way to…
1
vote
1 answer

View animations are suddenly gone after using layer animations

I'm using CABasicAnimation and CATransaction to animate some layers in my custom UIView. However, when after that returning to the rest of my app using a navigation controller's back button, the navigation controller does not animate anymore. Not…
1
vote
1 answer

CATransaction: problems when implementing a page flipping animation

I'm trying to implement a page flipping animation - which works, when the user doesn't navigate too fast through the pages. My code looks like this: [CATransaction begin]; [CATransaction setAnimationDuration:duration]; [CATransaction…
swalkner
  • 16,679
  • 31
  • 123
  • 210
1
vote
0 answers

CATransaction completion being called even view controller disappear

I am trying to animate my image view with three image sliding from left to right. I wrote following code to do it. However, setCompletionBlock is being called even when view controller disappear. So it causes weird problems with my previous view…
atalayasa
  • 3,310
  • 25
  • 42
1
vote
0 answers

UITableViewAlertForLayoutOutsideViewHierarchy error during batch update of UITableView with CATransaction

My app uses a tableView that is updated by batch updates. The cells have an indicatorImage that depends on the section of the table. When a cell is moved between sections, this indicator changes, and I want to animate the change of the indicator…
Reinhard Männer
  • 14,022
  • 5
  • 54
  • 116
1
vote
1 answer

Shrink ViewController to circular shape transition - swift

I'm trying to follow the example in this project to create an expand/shrink view controller transition. In my case, the view controller which is being presented will have the same background color as the button itself, therefore this animation is…
Alk
  • 5,215
  • 8
  • 47
  • 116
1
vote
1 answer

why CATransaction.setCompletionBlock seems not being called

The following code works on all the devices simulators I have access. However, some users reported the issue that leads me to think the completion block is not being called in some situation. I am out of idea at this moment. Any…
Sean
  • 2,967
  • 2
  • 29
  • 39
1
vote
2 answers

combine multiple CAAnimation sequentially

I was reading about CATransactions and then thought this might help solve my problem. This is what I wan't to do: I have 3 animations in the same layer, which all have their own duration. I create the animations using CAKeyframeAnimation with a…
Igon83
  • 21
  • 4
1
vote
1 answer

Why does animation jitter when CATransactions begin and end at about the same time?

Problem How can I fix the jitter in my scrolling animation? As seen in the animations below, there is a brief jitter every time the notes (black ovals) reach the vertical blue line, which makes it appear that the notes went backwards for a split…
1
vote
1 answer

Swift: Difference between two CAAnimation Disables

I am currently working with CABasic Animations on CALayers in Swift. What is the difference between CATransaction.setValue(kCFBooleanTrue, forKey:kCATransactionDisableActions) and CATransaction.setDisableActions(true)?
Razattax
  • 163
  • 1
  • 1
  • 12
1
vote
2 answers

CAShapeLayer Animation without having to update the path

When animating a CAShapeLayer, is it necessary to constantly keep updating the path of the layer, or is there a way to rely on CABasicAnimation alone? In the example below, I set up four circles paths and draw them. Then I want to animate them…
Johnny Rockex
  • 4,136
  • 3
  • 35
  • 55