iOS开发小知识点积累

淡入淡出效果

2017-03-30  本文已影响31人  学习ing兰

跳转代码

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];

}];```

上一篇下一篇

猜你喜欢

热点阅读