2014년 2월 14일 금요일

Animation

1. UINavigationController에 present & dismiss animation 적용

////// presentedViewController animation

CATransition* transition = [CATransition animation];
    transition.duration = 0.5;
    transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    transition.type = kCATransitionMoveIn;
    transition.subtype = kCATransitionFromTop;
    [self.navigationController.view.layer addAnimation:transition forKey:kCATransition];
    
    BoolshelfSubViewController *controller= [self.storyboard instantiateViewControllerWithIdentifier:@"BoolshelfSubViewController"];

    [self.navigationController pushViewController:controller animated:NO];
   

////// dismissViewControllerAnimated animation

CATransition* transition = [CATransition animation];
    transition.duration = 0.5;
    transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    transition.type = kCATransitionReveal;
    transition.subtype = kCATransitionFromBottom;
    [self.navigationController.view.layer addAnimation:transition forKey:nil];

    [[self navigationController] popViewControllerAnimated:NO];


2.  UIView를 이용한 animation 적용

[UIView beginAnimations:@"animation" context:nil];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO];
[UIView setAnimationDuration:0.7];

[self.navigationController pushViewController:pageViewController animated:NO];
pageViewController = nil;
    
[UIView commitAnimations];


3. UIView Layer에 animation 적용 


CATransition *animation = [CATransition animation];
[animation setDuration:0.2];
[animation setType:kCATransitionMoveIn];
[animation setSubtype:kCATransitionFromRight];
    [menuView.layer addAnimation:animation forKey:nil];

    [_menuContainerView addSubview:menuView];

댓글 없음:

댓글 쓰기