iOS 高仿果壳精选
PeaK12
8年前
<ul> <li> <p>话不多说,直接上图(由于简书上传图片只能是5M一下,所以GIF图的质量不是很高~~~)</p> </li> </ul> <p style="text-align:center"><img src="https://simg.open-open.com/show/6ad79bbba6ba583141f22b30b70f43b7.gif"></p> <p style="text-align:center">首页.gif</p> <p style="text-align:center"><img src="https://simg.open-open.com/show/bab66c44870b041bc55656a910a3ccff.gif"></p> <p style="text-align:center">点击.gif</p> <p style="text-align:center"><img src="https://simg.open-open.com/show/0ff117e735fab460276d63c8e393cc74.gif"></p> <p style="text-align:center">侧边栏.gif</p> <pre> <code class="language-objectivec">/** * 扩展展示 * * @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> <p> </p> <p>来自:http://www.jianshu.com/p/84d99d2c2fdb</p> <p> </p>