美文网首页
iOS改变Push 和 Pop的动态效果

iOS改变Push 和 Pop的动态效果

作者: CarrieQ | 来源:发表于2017-08-04 14:57 被阅读12次

    '''
    原文出处/尊重作者
    Objective-C改变push、pop动画为模态效果
    '''
    push:

    CATransition *transition = [CATransition animation];
    transition.duration = 0.4f;
    transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    transition.type = kCATransitionMoveIn;
    transition.subtype = kCATransitionFromTop;
    transition.delegate = self;
    [self.navigationController.view.layer addAnimation:transition forKey:nil];
    [self.navigationController pushViewController:controller animated:NO];
    

    pop:

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

    注意:animated一定要设置为:NO

    相关文章

      网友评论

          本文标题:iOS改变Push 和 Pop的动态效果

          本文链接:https://www.haomeiwen.com/subject/efnvlxtx.html