-(void)viewDidLoad{
[super viewDidLoad];
[self openSwiper];
//self.canInteractivePop=NO;//所有界面禁用交互式pop动画
}
-(LSTransitionAnimator *)swiperAnimatorForDefaultWithIsPush:(BOOL)isPush{
if (isPush) {
return [PushAnimator1 new];//此处PushAnimator1为自己定义的动画
}else{
return [PopAnimator1 new];////此处PopAnimator1为自己定义的动画
}
}
-(void)viewDidLoad{
[super viewDidLoad];
[self openSwiper];
self.canInteractivePop=NO;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.pushAnimator=[PushAnimator2 new];
self.pushAnimator.canInteractive=YES;//设置为YES则代表打开交互式push
}
- (UIViewController *)swiperBeginPushToNextController:(LSPanSwiper *)swiper{
SecondViewController *controller = [[SecondViewController alloc] init];
return controller;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.popAnimator=[PopAnimator2 new];
self.popAnimator.canInteractive=YES;
//nav.canInteractive=NO self.popAnimator.canInteractive=YES; 无交互动画
//nav.canInteractive=YES self.popAnimator.canInteractive=YES; 有交互动画
//nav.canInteractive=YES self.popAnimator.canInteractive=NO; 无交互动画
}
- (void)viewDidLoad {
[super viewDidLoad];
self.pushAnimator=[LSSpreadPushAnimator new];
self.pushAnimator.canInteractive=NO;//此动画使用CABasicAnimation,在ios11上不支持交互式动画,原因未知
}
//圆形扩散动画
- (IBAction)push:(id)sender {
self.pushAnimator.enabled=YES;//此处修改为YES因为下面有设置weiNO的地方
self.pushAnimator.isCircel=YES;
self.pushAnimator.fromRect=self.button1.frame;
SecondViewController *controller = [[SecondViewController alloc] init];
[self.navigationController pushViewController:controller animated:YES];
}
//矩形扩散动画
- (IBAction)push2:(id)sender {
self.pushAnimator.enabled=YES;
self.pushAnimator.isCircel=NO;
self.pushAnimator.fromRect=self.button2.frame;
SecondViewController *controller = [[SecondViewController alloc] init];
[self.navigationController pushViewController:controller animated:YES];
}
//同一界面有多自定义动画,还想使用默认push动画,push时只需要设置自定义动画的enabled=NO,需要时在打开就好了
- (IBAction)push3:(id)sender {
self.pushAnimator.enabled=NO;
ThreeViewController *controller = [[ThreeViewController alloc] init];
[self.navigationController pushViewController:controller animated:YES];
}