Xcode Storyboard 问题 - Button Bar Button 只出现在 TableViewController 的底部
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24983629/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode Storyboard issue - Button Bar Button only appears at the bottom of a TableViewController
提问by Craig Grummitt
Not sure if this is a bug in Xcode 6(I use Beta 4) or expected behaviour.
不确定这是 Xcode 6(我使用 Beta 4)中的错误还是预期行为。
When I have a View Controller in a Navigation Controller and 'push' (deprecated segue) a Table View Controller(TVC) I can drag a Bar Button Item to the Navigation Bar in the TVC.
当我在导航控制器中有一个视图控制器并“推”(不推荐使用)一个表视图控制器(TVC)时,我可以将一个栏按钮项拖到 TVC 中的导航栏中。
When I do the same but 'show' (new adaptive segue) the TVC, the Bar Button Item drops to the bottom, and in fact doesn't show up when I build the project.
当我执行相同操作但“显示”(新的自适应转场)TVC 时,条形按钮项下降到底部,实际上在我构建项目时不会显示。
A hack to resolve this problem is to set it up as 'Push' to begin with, drag on the Bar Button Item, and then change the segue to 'Show'. But - is this necessary? Is this an Xcode Bug or am I missing something?
解决此问题的一个技巧是将其设置为“Push”,然后拖动 Bar Button Item,然后将 segue 更改为“Show”。但是——这有必要吗?这是 Xcode 错误还是我遗漏了什么?
采纳答案by Dhaivat Vyas
I have tried creating the issue you are facing with bar button at bottom. It's not an issue or Xcode bug.
But in new Xcode when you use segue to 'Show (e.g. Push)' then in next view you won't get navigation bar.You need to add navigation bar and then add bar button item to navigation bar.
Hope your problem will be solved.
我尝试使用底部的条形按钮创建您面临的问题。这不是问题或 Xcode 错误。
但是在新的 Xcode 中,当您使用 segue 来“显示(例如推送)”时,在下一个视图中您将不会看到导航栏。您需要添加导航栏,然后将栏按钮项添加到导航栏。
希望你的问题会得到解决。
回答by Sanchal Kunnel
I had the same issue and fixed it by simply selecting the view controller and changing the "Top Bar" to "Opaque Navigation Bar" from Inferred. This let me add the Bar Button Item on top.
我遇到了同样的问题并通过简单地选择视图控制器并将“顶栏”从推断中更改为“不透明导航栏”来解决它。这让我在顶部添加 Bar Button Item。