- (void)showHideView:(UIView*)lo
{
float duration = .5;
int plusy = 30;
int variation = 50;
UIViewAnimationOptions ani = lo.tag==0?UIViewAnimationOptionTransitionCurlDown:UIViewAnimationOptionTransitionNone;
if (lo.tag==0) {
CGPoint cntr = lo.center;
cntr.y = variation;
lo.center = cntr;
}
[UIView transitionWithView:movieContainer.subviews.lastObject duration:duration options:ani animations:^{
if (lo.tag!=0) {
CGPoint cntr = lo.center;
cntr.y = variation;
lo.center = cntr;
}
} completion:^(BOOL finished) {
CGPoint cntr = lo.center;
if (lo.tag == 0) {
lo.tag = 1;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:duration];
cntr.y = plusy;
lo.center = cntr;
[UIView commitAnimations];
} else {
lo.tag = 0;
[UIView transitionWithView:lo duration:duration options:UIViewAnimationOptionTransitionCurlUp animations:^{
[lo setHidden:YES];
} completion:^(BOOL finished){
CGPoint cntr = lo.center;
cntr.y = -plusy;
lo.center = cntr;
[lo setHidden:NO];
}];
}
}];
}
Post a Comment