使用工具栏正确导航

Use toolbar to navigate properly

我正在尝试做一个类似 instagram 的工具栏(或者实际上是任何带有工具栏的应用程序)工具栏,以便从一个屏幕导航到另一个屏幕。

我有一个导航控制器,有 5 个屏幕,我已经这样做了:

self.toolbarItems = self.navigationController!.toolbarItems

@IBAction func profileButtonClicked(sender: UIBarButtonItem) { self.popToRootViewControllerAnimated(false) self.performSegueWithIdentifier("showProfile", sender: self) }

所以它工作正常,但我不喜欢先转到 navigationController 然后再转到 newViewController 的过渡,我希望根本没有过渡。

如果你能帮助我,我将不胜感激。

  1. 单击主故事板上的视图控制器
  2. 然后转到属性检查器
  3. 有个过渡风格的选项,选择cross dissolve

    或使用

      self.sourceViewController.presentViewController(self.destinationViewController as! UIViewController, animated: false, completion: nil)
    

找到:

只需要取消选中 "Animates",当您在故事板中单击 segue,然后转到 Attributes Inspector 并取消选中此复选框时。