views:

12

answers:

0

This has me really confused.

I'm working on a custom animation for rotating an image inside a custom UITableViewCell.

This all works fine when I place the code inside the same class as I'm calling it from, but fails if I put the code in it's parent.

So at the moment I have two classes defined as

@interface DummyEvent : Event

@interface Event : NSObject

If I call rotateImage inside DummyEvent it works. If I put the rotateImage function into the Event class the same code fails. But I can see the code executing in the debugger.

- (void)rotateImage:(UIImageView *)image duration:(NSTimeInterval)duration 
              curve:(int)curve degrees:(CGFloat)degrees
{
    // Setup the animation
    [UIView beginAnimations:@"test" context:NULL];
    [UIView setAnimationDuration:duration];
    [UIView setAnimationCurve:curve];
    [UIView setAnimationBeginsFromCurrentState:YES];

    // The transform matrix
    CGAffineTransform transform = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(degrees));
    image.transform = transform;

    // Commit the changes
    [UIView commitAnimations];
}