问题:项目中页面跳转需要用模态效果(页面上下进入推出),但是进来的页面还还是需要导航。
使用的是导航跳转(左右出现)页面,效果是模态效果(上下)出现页面
PUSH 推入:模拟出模态弹出效果
- (void)PushPresent {
TWOViewController *vc = [TWOViewController new];
CATransition *transition = [CATransition animation];
transition.duration = 0.25;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromTop;
transition.delegate = self;
[self.navigationController.view.layer addAnimation:transition forKey:nil];
//隐藏跳转的页面的导航条:实质是PUSH,所以用POP 推出
[self.navigationController pushViewController:vc animated:NO];
}
pop 弹出:模拟出模态弹出效果
- (void)popDissmiss{
CATransition *transition = [CATransition animation];
transition.duration = 0.25;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromBottom;
transition.delegate = self;
[self.navigationController.view.layer addAnimation:transition forKey:nil];
self.navigationController.navigationBarHidden = NO;
[self.navigationController popViewControllerAnimated:NO];
}
学无止境,做个记录
2017-01-19-SXH
网友评论