淡入淡出,弹入弹出动画代码

-(void)textAction{

    if (isFadeOut) {

        //navigationbar淡出

        _mainView.navigationbar.alpha = 1.0f;

        [UIViewbeginAnimations:@"fadeOut"context:nil];

        [UIViewsetAnimationDuration:0.7];

        [UIViewsetAnimationDelegate:self];

        [UIView setAnimationDidStopSelector:@selector(animationStop)];

        _mainView.navigationbar.alpha = 0.0f;

        [UIViewcommitAnimations];

        

        //toolbar弹出

        

        [UIViewbeginAnimations:@"moveOut"context:nil];

        [UIViewsetAnimationDuration:0.7];

        CGRect temp = _mainView.toolbarFrame;

        temp.origin.y = temp.origin.y+45;

        _mainView.toolbar.frame =temp;

        [UIViewcommitAnimations];

        

        //desText下移

        [UIViewbeginAnimations:@"desDown"context:nil];

        [UIViewsetAnimationDuration:0.7];

        SJShowRemoteWorldView *tempView = (SJShowRemoteWorldView *)_mainView;

        temp = tempView.desTextBackgroundRect;

        temp.origin.y = temp.origin.y+45;

        tempView.desTextBackground.frame =temp;

        [UIViewcommitAnimations];

        

    }else{

        _mainView.navigationbar.alpha = 0.0f;

        [UIViewbeginAnimations:@"fadeIn"context:nil];

        [UIViewsetAnimationDuration:0.7];

        [UIViewsetAnimationDelegate:self];

        [UIView setAnimationDidStopSelector:@selector(animationStop)];

        _mainView.navigationbar.alpha = 1.0f;

        [UIViewcommitAnimations];

        

        [UIViewbeginAnimations:@"moveIn"context:nil];

        [UIViewsetAnimationDuration:0.7];

        

        _mainView.toolbar.frame =_mainView.toolbarFrame;

        [UIViewcommitAnimations];

        

        //desText下移

        [UIViewbeginAnimations:@"desUp"context:nil];

        [UIViewsetAnimationDuration:0.7];

        SJShowRemoteWorldView *tempView = (SJShowRemoteWorldView *)_mainView;

        tempView.desTextBackground.frame =tempView.desTextBackgroundRect;

        ;

        [UIViewcommitAnimations];

    }

 

}

 

-(void)animationStop{

    NSLog(@"stop stop");

    isFadeOut = !isFadeOut;

}

posted @ 2013-10-10 16:02  mapleyuan  阅读(251)  评论(0)    收藏  举报