views:

100

answers:

0

I have some strange problem with CATransactions nested:

- (void) setXShift:(int)newShift;
{ 
   [CATransaction begin];
   [CATransaction setAnimationDuration_c:1];       //1

   if(newShift > 0 &&
      image.x  < image2.x &&
      image.x  <= 0 &&
      image.x  > -image.w + 800)
   {
      [CATransaction begin];
      [CATransaction setAnimationDuration_c:0];    //2
      image2.x = image.x - image.w;                //3
      [CATransaction commit];
   }


   xShift = newShift;
   image.x  += xShift;
   image2.x += xShift;
   xShift = 0;

   [CATransaction commit];
}

Animation marked as (3) should go on for 0 seconds (2), but insted it goes on for 1 second (1). I have no idea why, I've never had problems with that...

PS. CATransaction setAnimationDuration_c: is just a shortcut for [CATransaction setValue: forKey:kCATransactionAnimationDuration];

Any ideas?