ios – 将uiviewcontroller推送到另一个带有顶部 – 底部动画的viewcontroller

ios – 将uiviewcontroller推送到另一个带有顶部 – 底部动画的viewcontroller,第1张

概述在我的项目中有一个功能,当用户在顶部栏上滑动时,一个屏幕将出现从上到下的动画 有两个视图控制器 oneviewcontroller.m - (void)swipe{ listViewController *list_obj=[[listViewController alloc] initWithNibName:@"listViewController" bundle:NULL]; 在我的项目中有一个功能,当用户在顶部栏上滑动时,一个屏幕将出现从上到下的动画

有两个视图控制器
onevIEwcontroller.m

- (voID)swipe{    ListVIEwController *List_obj=[[ListVIEwController alloc] initWithNibname:@"ListVIEwController" bundle:NulL];    uiviewanimationtransition trans = uiviewanimationtransitionCurlUp;    [UIVIEw beginAnimations: nil context: nil];    [UIVIEw setAnimationTransition: trans forVIEw: [self.vIEw window] cache: YES];    [self.navigationController pushVIEwController:List_obj animated:YES];    [UIVIEw commitAnimations];}

但是这并不能让动画从上到下

我想实现导航
推:=顶部 – 底部
Pop:= bottom – top

请帮我
谢谢

解决方法 您可以将视图控制器从上到下推送,如下所示:

OBJ-C:

- (voID) pushVC:(UIVIEwController )dstVC {    CATransition Transition = [CATransition animation];    Transition.duration = 0.5;    Transition.timingFunction = [camediatimingFunction functionWithname:kcamediatimingFunctionEaseInEaSEOut];    Transition.type = kCATransitionPush;    Transition.subtype = kCATransitionFromtop;    [self.navigationController.vIEw.layer addAnimation:Transition forKey:kCATransition];    [self.navigationController pushVIEwController:dstVC animated:NO];}

使用以下代码从下到上d出视图控制器:

- (voID) popVC {    CATransition Transition = [CATransition animation];    Transition.duration = 0.5;    Transition.timingFunction = [camediatimingFunction functionWithname:kcamediatimingFunctionEaseInEaSEOut];    Transition.type = kCATransitionFade;    Transition.subtype = kCATransitionFromBottom;    [self.navigationController.vIEw.layer addAnimation:Transition forKey:kCATransition];    [self.navigationController popVIEwControllerAnimated:NO];}

斯威夫特3:

func open() {    let settingsVC = SettingsVC()    let Transition = CATransition()    Transition.duration = 0.5    Transition.timingFunction = camediatimingFunction(name: kcamediatimingFunctionEaseInEaSEOut)    Transition.type = kCATransitionPush    Transition.subtype = kCATransitionFromtop    navigationController?.vIEw.layer.add(Transition,forKey: kCATransition)    navigationController?.pushVIEwController(settingsVC,animated: false)  }  func close() {    let Transition = CATransition()    Transition.duration = 0.5    Transition.timingFunction = camediatimingFunction(name: kcamediatimingFunctionEaseInEaSEOut)    Transition.type = kCATransitionFade    Transition.subtype = kCATransitionFromBottom    navigationController?.vIEw.layer.add(Transition,forKey:kCATransition)    let _ = navigationController?.popVIEwController(animated: false)  }
总结

以上是内存溢出为你收集整理的ios – 将uiviewcontroller推送到另一个带有顶部 – 底部动画的viewcontroller全部内容,希望文章能够帮你解决ios – 将uiviewcontroller推送到另一个带有顶部 – 底部动画的viewcontroller所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1004373.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存