View transform seems to be ignored when animating on iphone. Why?

Posted by heymon on Stack Overflow See other posts from Stack Overflow or by heymon
Published on 2010-06-10T12:48:53Z Indexed on 2010/06/10 12:53 UTC
Read the original article Hit count: 270

Filed under:
|
|
|

I have views that can be rotated, scaled and moved around the screen. I want the view to resize and be orthogonal when the user double tap's the view to edit the textview within.

The code is below.

Somewhere the transform is getting reset. The NSLog statement below prints the identity transform, but a print of the transform when the animation is complete in transitionDidStop reveals that the transform is what it was before I thought I set it to identity. The view resizes, but it acts like the transform was never set to identity?

Any ideas/pointers?

            originalBounds = self.bounds;
        originalCenter = self.center;
        originalTransform = self.transform;

        r = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width - 70, 450);

        [UIView beginAnimations: nil context: NULL];
        [UIView setAnimationDelegate: self];
        [UIView setAnimationDidStopSelector: @selector(transitionDidStop:finished:context:)];
        self.transform = CGAffineTransformIdentity;
        NSLog(@"%@ after set", NSStringFromCGAffineTransform([self transform]));
        [self setBounds: r];
        [self setCenter: p];
        [self setAlpha: 1.0];
        [UIView commitAnimations];
        [textView becomeFirstResponder];

© Stack Overflow or respective owner

Related posts about iphone

Related posts about animation