作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
在 Objective-C 中,我想从右到左关闭模态 ViewController。
现在我可以在模态上从左向右移动。但是我不知道如何像推屏转换一样从左到右关闭这个模态 VC。
这是从 a-ViewController 移动到 b-ViewController 的代码。
bViewController *nextVC = [[bViewController alloc] initWithNibName:nil bundle:nil];
CATransition *transition = [CATransition animation];
transition.duration = 0.5;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
transition.type = kCATransitionPush ;
[transition setSubtype:kCATransitionFromLeft];
[[nextVC.view layer] addAnimation:transition forKey:@"TransitionTest"];
//[self presentViewController:nextVC animated:YES completion:nil];
//if it's possible, I want to use upside's cord.(don't addSubView) but I don't know how to do it)
[self.view addSubview:nextVC.view] ;
最佳答案
objective-C
CATransition *transition = [CATransition animation];
transition.duration = 0.4;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromRight;
[self.view.window.layer addAnimation:transition forKey:nil];
[self dismissViewControllerAnimated:NO completion:nil];
swift 5
let transition = CATransition()
transition.duration = 0.5
transition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
transition.type = CATransitionType.push
transition.subtype = CATransitionSubtype.fromRight
self.view.window!.layer.add(transition, forKey: nil)
self.dismiss(animated: false, completion: nil)
关于ios - 如何从右到左关闭模态 ViewController?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35694091/
我来自 Asp.Net 世界,试图理解 Angular State 的含义。 什么是 Angular 状态?它类似于Asp.Net中的ascx组件吗?是子页面吗?它类似于工作流程状态吗? 我听到很多人
我一直在寻找 3 态拨动开关,但运气不佳。 基本上我需要一个具有以下状态的开关: |开 |不适用 |关 | slider 默认从中间开始,一旦用户向左或向右滑动,就无法回到N/A(未回答)状态。 有人
我是一名优秀的程序员,十分优秀!