美文网首页
iOS开发 一句话搞定push圆形扩散效果转场动画

iOS开发 一句话搞定push圆形扩散效果转场动画

作者: 番茄炒西红柿啊 | 来源:发表于2018-10-31 16:52 被阅读33次

    1.先看下效果图:

    demo.gif

    2.使用代码:

    - (IBAction)buttonClick:(id)sender {
        UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
        [self.navigationController pushViewController:[sb instantiateViewControllerWithIdentifier:@"NextViewController"]
                                             animated:YES
                                                 doit:YES
                                                 rect:self.testButton.frame];
    }
    

    3.方法说明:

    /**
     自定义push方法
     当doit为NO时,等效-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
    
     @param viewController 目标vc
     @param animated 是否执行动画
     @param doit YES: 自定义转场动画 NO: 系统自带动画
     @param rect 当doit为YES时,动画开始的起点frame
     */
    - (void)pushViewController:(UIViewController *)viewController
                      animated:(BOOL)animated
                          doit:(BOOL)doit
                          rect:(CGRect)rect;
    

    demo地址

    相关文章

      网友评论

          本文标题:iOS开发 一句话搞定push圆形扩散效果转场动画

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