有两个视图控制器
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所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)