zoukankan      html  css  js  c++  java
  • presentModalViewController方法,present一个透明的viewController,带动画效果

    //假设需要被present的控制器实例为controller,controller的背景色设置为clearColor
    UIViewController * rootcontroller = self.view.window.rootViewController; rootcontroller.modalPresentationStyle = UIModalPresentationCurrentContext;//进入的动画失效
    [rootcontroller presentViewController:controller animated:NO completion:
    ^{ rootcontroller.modalPresentationStyle = UIModalPresentationFullScreen; }]; controller.view.transform = CGAffineTransformMakeTranslation(0, controller.view.frame.size.height); [UIView animateWithDuration:0.35 animations:^{ controller.view.transform = CGAffineTransformMakeTranslation(0, 0); }];

     将其封装成Catrgory后,备用:

    - (void) presentTransparentController:(UIViewController *)controller withDuration:(CGFloat) duration {
        
        controller.view.backgroundColor = [UIColor clearColor];
        controller.view.transform = CGAffineTransformMakeTranslation(0, controller.view.frame.size.height);
        [UIView animateWithDuration:duration animations:^{
            controller.view.transform = CGAffineTransformMakeTranslation(0, 0);
        }];
        
        self.modalPresentationStyle = UIModalPresentationCurrentContext;//让进入的动画失效
        [self presentViewController:controller animated:NO completion:^{
            self.modalPresentationStyle = UIModalPresentationFullScreen;
        }];
    }
  • 相关阅读:
    poj 1584
    poj 1113 & poj 2187
    pku 1321 棋盘问题
    poj 1408
    pku 2251 Dungeon Master
    sdut oj 2218 Give Me an E
    Android工程 单元测试
    Android Timer编写方式
    去除工程的.svn隐藏文件夹
    Android 绑定远程服务出现 Not Allowed to bind service
  • 原文地址:https://www.cnblogs.com/benbenzhu/p/3571629.html
Copyright © 2011-2022 走看看