Str*_* B. 21 transition ios swift
我正在使用presentViewController从一个视图更改为另一个没有导航控制器,如:
let HomeView = self.storyboard!.instantiateViewControllerWithIdentifier("HomeView") as! ViewControllerHome
self.presentViewController(HomeView, animated:true, completion: nil)
Run Code Online (Sandbox Code Playgroud)
如何改变过渡?我想像导航控制器一样动画.
我可以使用另一个转换,但我发现我想要的转换是我正在使用的代码
let HomeView = self.storyboard!.instantiateViewControllerWithIdentifier("HomeView") as! ViewControllerHome
HomeView.modalTransitionStyle = UIModalTransitionStyle.PartialCurl
self.presentViewController(HomeView, animated:true, completion: nil)
Run Code Online (Sandbox Code Playgroud)
Mar*_*r-k 23
Mehul的答案是正确的,但你也可以按你想要的方式去做.使用instantiateViewController(withIndentifier:string)
我是这样做的:
let destController = self.storyboard?.instantiateViewController(withIdentifier: "") as! YourViewController
destController.modalTransitionStyle = .flipHorizontal
self.navigationController?.present(destController, animated: true, completion: nil) // OR
let destController = self.storyboard?.instantiateViewController(withIdentifier: "") as! YourViewController
destController.modalTransitionStyle = .flipHorizontal
self.present(destController, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)
Meh*_*hul 13
对于在iOS8上这样做的人来说,这就是我必须要做的:
我有一个名为SettingsView.swift的swift类文件和一个名为SettingsView.xib的.xib文件.我在MasterViewController.swift中运行它(或任何视图控制器真的打开第二个视图控制器)
@IBAction func openSettings(sender: AnyObject) {
var mySettings: SettingsView = SettingsView(nibName: "SettingsView", bundle: nil) /<--- Notice this "nibName"
var modalStyle: UIModalTransitionStyle = UIModalTransitionStyle.CoverVertical
mySettings.modalTransitionStyle = modalStyle
self.presentViewController(mySettings, animated: true, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
21980 次 |
| 最近记录: |