views:

67

answers:

1

I have some code in my iPhone app like that :

//fromView is a UIImageView. 
//self is a UIView.
        UIGraphicsBeginImageContext(fromView.bounds.size); 
        [fromView.layer renderInContext:UIGraphicsGetCurrentContext()]; 
        UIImage *dummyFromImage = UIGraphicsGetImageFromCurrentImageContext(); 
        UIGraphicsEndImageContext();
        UIImageView* dummyImageView = [[UIImageView alloc] initWithImage:dummyFromImage]; 
        [self addSubview:dummyImageView];
        [UIView beginAnimations:nil context:nil]; 
        [UIView setAnimationDuration:0.5]; 
        [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView: dummyImageView cache:YES]; //line:9 
        [UIView commitAnimations];

The dummyImageView only show but never flip, if you change line9's dummyImageView to fromView, fromView do flip, Please tell me why?

+1  A: 
    [UIView setAnimationTransition:… forView: dummyImageView cache:YES]; //line:9 

The view in the -setAnimationTransition:… method should be assigned to the view that contains the change. In your case, self.

The dummyImageView itself is not changed (exterior changes such as changing superview is irrelevant), so the animation can do nothing.

KennyTM