present 出一个半透明的viewcontroller
NavigationController * nav = [[NavigationController alloc] initWithRootViewController:aViewController];
或者是模拟present的动画 push出新的viewcontroller
CATransition* transition = [CATransitionanimation];
transition.duration =0.4f;
transition.type =kCATransitionMoveIn;
transition.subtype =kCATransitionFromTop;
[self.navigationController.view.layeraddAnimation:transition forKey:kCATransition];
[self.navigationControllerpushViewController:aViewControlleranimated:NO];
退回的时候的动画
CATransition* transition = [CATransitionanimation];
transition.duration =0.4f;
transition.type =kCATransitionReveal;
transition.subtype =kCATransitionFromBottom;
[self.navigationController.view.layeraddAnimation:transition forKey:kCATransition];
[self.navigationControllerpopViewControllerAnimated:NO];
还要透明的话 只能在当前页面抓个图了
- (UIImage *)capture
{
UIGraphicsBeginImageContextWithOptions(CGSizeMake(MainScreenWidth,kTopBackgroundImageViewHeight), self.view.opaque,0.0);
[self.navigationController.view.layerrenderInContext:UIGraphicsGetCurrentContext()];
UIImage * img =UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}
把这个image 设置为推出来viewcontrolleer 的最上层iamgeview的backimageview,再设个透明度就能搞定了