gpt4 book ai didi

iphone - 如何在 iphone 中制作像 pop 这样的动画而不是 push

转载 作者:行者123 更新时间:2023-12-01 18:23:46 26 4
gpt4 key购买 nike

我正在使用以下代码:

FirstView * fir=[[FirstView alloc]init];
[self.navigationController pushViewController:fir animated:NO];

我想做一个像popview Controller 这样的动画。

提前致谢。

最佳答案

-(void)ButtonAction:(id)sender{
[self SwipeRight:self.navigationController.view]; // <--calling method
//[self.navigationController pushViewController:viewcontrollerobject animated:NO];
// or pop //
}

-(void)SwipeRight:(UIView *)view{

CATransition* transition = [CATransition animation];
[transition setDuration:0.3];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromRight;
[transition setFillMode:kCAFillModeBoth];
[transition setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[view.layer addAnimation:transition forKey:kCATransition];
}

-(void)SwipeLeft:(UIView *)view{
CATransition* transition = [CATransition animation];
[transition setDuration:0.3];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromLeft;
[transition setFillMode:kCAFillModeBoth];
[transition setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[view.layer addAnimation:transition forKey:kCATransition];
}

关于iphone - 如何在 iphone 中制作像 pop 这样的动画而不是 push,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15493570/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com