Here's the viewDidLoad from the main view controller in the test project:
- (void)viewDidLoad
{[super viewDidLoad];
UIView *containerView = [[UIView alloc] initWithFrame:CGRectMake(10, 10, 300, 300)]; [self.view addSubview:containerView]; UIView *redView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 300)]; [redView setBackgroundColor:[UIColor redColor]]; [containerView addSubview:redView]; UIView *yellowView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 300)]; [yellowView setBackgroundColor:[UIColor yellowColor]]; [UIView transitionWithView:containerView duration:3 options:UIViewAnimationOptionTransitionFlipFromLeft animations:^{ [redView removeFromSuperview]; [containerView addSubview:yellowView]; } completion:NULL]; }
Only a yellow frame will appear. There is no animation, whatever the UIViewAnimationOption is. Why???
EDIT: I also tried using performSelector withDelay to move the animation from viewDidLoad to another method. The same result - no animation.
Also tried the following: [UIView transitionFromView: redView toView: yellowView duration: 3 options: UIViewAnimationOptionTransitionFlipFromLeft: NULL];
However, only a yellow appearance appears. No animation.
soleil
source share