Reputation: 483
I have a Custom view. This custom view has two UIImageViews - imageview1 and imageview2.
[UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:2.00]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(transitionDidStop:finished:context:)]; [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self cache:YES]; if(frontVisible) { [imageview1 removeFromSuperview]; [self addSubview: imageview2]; } else { [imageview2 removeFromSuperview]; [self addSubview: imageview1]; } frontVisible = !frontVisible; [UIView commitAnimations];
The image changes from imageview1 to imageview2 and viceversa but I dont get the flip effect. Instead I see the fading out of one image as the other appears.
Upvotes: 1
Views: 1058
Reputation: 243146
The reason you're not getting the curl transition to work is because the curl transition does not work in the simulator. It shows up as a fade instead.
Upvotes: 1
Reputation: 10413
Not really sure but I checked the documentation and found this:
Discussion
If you want to change the appearance of a view during a transition—for example, flip from one view to another—then use a container view, an instance of UIView, as follows:
- Begin an animation block.
- Set the transition on the container view.
- Remove the subview from the container view.
- Add the new subview to the container view.
- Commit the animation block.
So it says you have to create a container view in order to make it work properly.
Upvotes: 1