我正在关注this tutorial ,我正在尝试添加一个“栏按钮”。该教程内容如下:
While you’re there, change the title of the screen to Add Player (by double-clicking in the navigation bar). Also add two Bar Button Items to the navigation bar. In the Attributes inspector, set the Identifier of the button to the left to Cancel, and the one on the right to Done (also change this one’s Style from Bordered to Done).
我按照步骤操作,但每次我拖动“条形按钮”将其放置在导航栏上时,它会自动移动到场景的左下方,如图 1 所示
请让我知道以下内容
1-如何在导航栏上放置栏按钮
2-如何将“ Root View Controller ”重命名为“添加玩家”
image-1:
最佳答案
在 Storyboard中禁用 NavigationController 的 navigationBar 的半透明属性。
如果您启用了半透明,那么您不能将栏项目拖动到导航栏。
现在您可以通过 Storyboard将 Bar item 拖到 Navigation bar。
关于ios - 如何在导航栏上放置一个栏按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44304031/