淡入淡出效果

跳转代码

SearchViewController* searchVC = [[SearchViewControlleralloc]init];

CATransition*animation= [CATransitionanimation];

animation.timingFunction=UIViewAnimationCurveEaseInOut;

animation.type=@"Fade";

animation.duration=.3f;

animation.subtype=kCATransitionFromRight;

[[UIApplicationsharedApplication].keyWindow.layeraddAnimation:animationforKey:nil];

UINavigationController*nav = [[UINavigationControlleralloc]initWithRootViewController:searchVC];

[self.navigationControllerpresentViewController:navanimated:NOcompletion:nil];```
返回代码

__weaktypeof(self) weakSelf =self;

[UIViewanimateWithDuration:.3animations:^{

weakSelf.view.alpha=0;

}completion:^(BOOLfinished) {

[weakSelf.navigationControllerdismissViewControllerAnimated:NOcompletion:nil];

}];```

你可能感兴趣的:(淡入淡出效果)