我有一个 ViewController。应用程序中有一个 NavigationController。当我将 Bar Button Item 拖到导航栏时,该项目通常会到达 ViewController 的底部。虽然在过去,我设法让它固定在右上角,它应该去的地方。
知道为什么这有时有效有时无效吗?还有,为什么会掉到底部?走到底部不遵循 HIG。
最佳答案
确保您的 ViewController 在 NavigationViewController 下。
然后,您必须首先将导航项插入导航栏,然后添加您的 BarButtonItem。我看到在 Interface Builder 中,我们只能在左侧添加 1 个 BarButtonItem,在右侧添加 1 个 BarButtonItem。
关于swift - 为什么 BarButton 会转到 View 底部?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29565454/