OGeek|极客世界-中国程序员成长平台

标题: ios - 扩展界面构建状态栏下的导航栏 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 09:49
标题: ios - 扩展界面构建状态栏下的导航栏

导航栏在模拟器上运行时呈现应有的效果,因为我正在实现委托(delegate)方法。

extension AboutViewController: UINavigationBarDelegate {
   func positionForBar(bar: UIBarPositioning) -> UIBarPosition {
      return .TopAttached
   }
}

但我希望它在界面生成器中呈现时看起来相同。我该怎么做?

enter image description here

enter image description here

编辑

这是编辑器菜单,那里没有 pin 选项。

enter image description here



Best Answer-推荐答案


不要将顶部约束添加到Top Layout Guide,而是在Interface Builder中选择导航栏并转到Editor > Pin > Top Space to Superview

突然在 Xcode 7 中没有 Pin 菜单。所以尝试这样做(见屏幕截图)。

enter image description here

关于ios - 扩展界面构建状态栏下的导航栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31919052/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://jike.in/) Powered by Discuz! X3.4