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