NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
if(oldView != nil){
[dict setObject:oldView forKey:@"oldView"];
}
if(newView != nil){
[dict setObject:newView forKey:@"newView"];
}
[NSTimer scheduledTimerWithTimeInterval:0.0 target:self selector:@selector(onTimer:) userInfo:dict repeats:NO];
[dict release];
- (void)onTimer:(NSTimer *)timer {
UIView *oldView = [[timer userInfo] objectForKey:@"oldView"];
UIView *newView = [[timer userInfo] objectForKey:@"newView"];
[UIView animateWithDuration:2.0 delay:0
options:UIViewAnimationOptionAllowUserInteraction
animations:^{
oldView.alpha = 0.0;
newView.alpha = 1.0;
}
}
转载:http://blog.sina.com.cn/s/blog_7004897a0100xzi1.html