快速改变视图

  • 本文关键字:视图 改变 swift
  • 更新时间 :
  • 英文 :


我为Apple Watch制作了一个应用程序("Brain Trainer For Apple Watch"),它使用以下代码:

pushControllerWithName("SumsInterfaceController", context: type)

我想知道 iPhone 版本的 Swift 是否有类似的代码?

用于导航控制器

navigationController?.pushViewController(viewController, animated: true)

有关更多信息,请查看此内容。

对于 Segue,请检查这个和这个。

For UIViewController

self.presentViewController(viewControllerToPresent: UIViewController, animated flag: Bool, completion: (() -> Void)?)
self.performSegueWithIdentifier(identifier: String?, sender: AnyObject?)

对于UINavigationController:UIViewController

self.pushViewController(viewController: UIViewController, animated: Bool)

关闭 UIViewController

self.dismissViewControllerAnimated(flag: Bool, completion: (() -> Void)?)

Disshort UINavigationController: UIViewController

self.popViewControllerAnimated(animated: Bool)
self.popToViewController(viewController: UIViewController, animated: Bool)
self.popToRootViewControllerAnimated(animated: Bool)

最新更新