使用工具栏正确导航

时间:2015-09-08 09:47:25

标签: ios swift navigation toolbar swift2

我正在尝试像Instagram一样(或任何带有工具栏的应用程序)工具栏,从屏幕导航到屏幕。

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

  • 在每个屏幕中,在viewDidLoad中,我输入:

self.toolbarItems = self.navigationController!.toolbarItems

  • 在navigationController中,对于一个BartbuttonItem我有这个 功能例如:

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

所以它正在工作,但是当我第一次访问navigationController然后转到newViewController时,我不喜欢转换,我希望根本没有转换。

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

2 个答案:

答案 0 :(得分:1)

  1. 单击主故事板上的视图控制器
  2. 然后转到属性检查器
  3. 有一个名为过渡样式的选项,选择交叉溶解

    或使用

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

答案 1 :(得分:0)

发现:

只需要取消选中“Animates”,当你点击storyBoard中的segue然后转到属性检查器并取消选中此复选框时。

enter image description here

相关问题