iOS 高仿果殼精選

PeaK12 8年前發布 | 5K 次閱讀 iOS開發 移動開發

  • 話不多說,直接上圖(由于簡書上傳圖片只能是5M一下,所以GIF圖的質量不是很高~~~)

首頁.gif

點擊.gif

側邊欄.gif

/**

  • 擴展展示 *
  • @param viewController 要展示的VC
  • @param frame 白色展開條的初始位置 / -(void)animationTo:(UIViewController)viewController from:(CGRect)frame{ UIWindow *keyWindow = [[UIApplication sharedApplication]keyWindow];

    //黑色遮罩 UIView *backgroudView = [[UIView alloc]initWithFrame:keyWindow.bounds]; backgroudView.backgroundColor = [UIColor blackColor]; backgroudView.alpha = 0.7; [keyWindow addSubview:backgroudView];

    //白色展開塊 UIView *whiteView = [[UIView alloc]initWithFrame:frame]; whiteView.backgroundColor = [UIColor whiteColor]; [keyWindow addSubview:whiteView];

    NSTimeInterval timeInterval = 0.5;

    [UIView animateWithDuration:timeInterval animations:^{

    whiteView.frame = CGRectMake(0, 0, kSCREEN_WIDTH, kSCREEN_HEIGHT);
    

    } completion:^(BOOL finished) {

    UINavigationController* nav = [[UINavigationController alloc]initWithRootViewController:viewController];
    //這兩句可以保證,下一個視圖覆蓋了當前視圖的時候,當前視圖依然在渲染
    viewController.modalPresentationStyle = UIModalPresentationOverCurrentContext;
    nav.modalPresentationStyle = UIModalPresentationOverCurrentContext;
    
    [self presentViewController:nav animated:NO completion:^{
        [whiteView removeFromSuperview];
        [backgroudView removeFromSuperview];
    }];
    

    }];

    [UIView animateWithDuration:timeInterval animations:^{

    self.navigationController.view.transform = CGAffineTransformMakeScale(0.85, 0.85);
    

    } completion:^(BOOL finished) {

    self.navigationController.view.transform = CGAffineTransformIdentity;
    

    }];

}</code></pre>

 

來自:http://www.jianshu.com/p/84d99d2c2fdb

 

 本文由用戶 PeaK12 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!