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.

73 questions
37
votes
3 answers

CoreAnimation warning deleted thread with uncommitted CATransaction

I am having issues with the following warning: CoreAnimation: warning, deleted thread with uncommitted CATransaction; set CA_DEBUG_TRANSACTIONS=1 in environment to log backtraces. I am using an NSOperation object to perform some calculations, once…
Milly
  • 635
  • 1
  • 6
  • 11
34
votes
2 answers

+[CATransaction synchronize] called within transaction

If I close my iPad app while I'm loading data from services, the app closes but then immediately opens again without my doing anything. At this point, I am not able to do anything; I can't close the app and I can't interact with the app or the…
Confused
  • 341
  • 1
  • 3
  • 3
20
votes
3 answers

How to specify selector when CAKeyframeAnimation is finished?

I'm using a CAKeyframeAnimation to animate a view along a CGPath. When the animation is done, I'd like to be able to call some other method to perform another action. Is there a good way to do this? I've looked at using UIView's…
Daren
  • 757
  • 2
  • 7
  • 18
16
votes
1 answer

Xcode: How to set CA_DEBUG_TRANSACTIONS=1?

I'm getting this warning in the log window of the debugger: CoreAnimation: warning, deleted thread with uncommitted CATransaction; set CA_DEBUG_TRANSACTIONS=1 in environment to log backtraces. I have to find out what code of mine is calling…
VikR
  • 3,484
  • 3
  • 34
  • 70
11
votes
1 answer

Called within transaction When UIsearch Bar clicked and keyboard showed

I did a ViewController where there is a button and UITextfield when I click the button a UITableViewController with a UISearchBar is presented and a list of languages is displayed. My issue is when I run the app the first time I click the button and…
cczak
  • 145
  • 11
11
votes
1 answer

Can I cancel the CATransaction completionBlock?

In a CATransaction I have the following code: [CATransaction setCompletionBlock:^{ ...do something .... }]; The animation runs for about half a second. I want to be able to cancel the completion block if some other events happen in the class…
zumzum
  • 13,218
  • 19
  • 89
  • 125
9
votes
2 answers

Animations not stopping after view controller is dismissed using tab bar

The Problem I have two view controllers, both are contained within respective UINavigationControllers and a single UITabBarController. On one of the view controllers I am creating a bubbles effect, where I draw bubbles on the screen and animate…
Ollie
  • 1,831
  • 1
  • 15
  • 34
8
votes
2 answers

Animate custom CALayer properties inside a CATransaction

Until now I've been able to animate the custom properties of my CALayer subclass, thanks to + (BOOL)needsDisplayForKey:(NSString *)key and CABasicAnimations. However it turns out that chaining animations can become very tricky because all the code…
romrom
  • 606
  • 1
  • 6
  • 13
8
votes
1 answer

CATransaction completion block never fires

How come the completion block for this CATransaction never fires? [CATransaction begin]; [CATransaction setCompletionBlock:^{ // table animation has finished NSLog(@"why does this section never execute?"); }]; [self.tableView…
Darren
  • 1,359
  • 11
  • 22
7
votes
2 answers

CABasicAnimation flicker when applying the completion

I am trying to apply a rotation animation by number of degrees to a UIImageView and persist the rotation transformation in the completion block. The problem that I am facing is that when the completion block is executed there is a visible flicker…
Laur Stefan
  • 1,871
  • 3
  • 20
  • 49
6
votes
1 answer

Disable implicit animation without CATransaction begin&commit

I see many people use this to disable implicit animation: [CATransaction begin]; [CATransaction setDisableActions:YES]; someLayer.backgroundColor = someCGColor;//no animation [CATransaction commit]; But without CATransaction begin&commit it also…
Aunn
  • 76
  • 4
6
votes
1 answer

CoreAnimation: warning, deleted thread with uncommitted CATransaction

While my app is running, I often get the following warning: CoreAnimation: warning, deleted thread with uncommitted CATransaction; set CA_DEBUG_TRANSACTIONS=1 in environment to log backtraces. Does anyone have an idea why this message shows up…
Elendas
  • 543
  • 3
  • 7
  • 19
5
votes
1 answer

how can I detect the completion of an animation triggered by CATransaction

I have a CALayer which I merely create and add to a subview of my view controller's main view in the controller's initWithNibName: And then, I perform the following animation: [CATransaction begin]; [CATransaction setAnimationDuration:2]; …
SaldaVonSchwartz
  • 3,669
  • 2
  • 37
  • 76
5
votes
1 answer

How to keep a CALayer at the same position while resizing the parent NSView?

Imagine a small red box (CALayer instance) drawn in the lower left corner of its parent layer (which is the root layer of a layer hosting NSView). When the frame of the parent view changes, the red box should remain at the same position on the…
Mark
  • 5,965
  • 1
  • 37
  • 77
5
votes
1 answer

+[CATransaction synchronize] called within transaction when search

I implemented a searchController and added in navigationItem. That's code: var searchController = UISearchController(searchResultsController: nil) searchController.obscuresBackgroundDuringPresentation = false definesPresentationContext =…
Rafaela Lourenço
  • 1,005
  • 13
  • 29
1
2 3 4 5