Have you tried plain old UIViewAnimation clause? Maybe play with view properties of hidden or alpha and if you want this to fade out to black, you need to [Window setBackgroundColor:[UIColor blackColor]]; first.
Make sure the animations happen in the main thread. Sample code following with
view1 being the first subview of window and view2 the other subview of window.
- (void)switchToView1 {
[UIView beginAnimations:@"fadeOut1" context:NULL];
[UIView setAnimationDuration:.5];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
view1.hidden = YES;
[UIView commitAnimations];
}
- (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
if ([@"fadeOut1" isEqualToString:animationID] && [finished intValue] == 1) {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:.5];
view2.hidden = NO;
[UIView commitAnimations];
}
}
如果做这种工作,则要打好uck。