【问题标题】:SideMenu left not using the full height of the screenSideMenu 未使用屏幕的整个高度
【发布时间】:2018-11-15 13:36:13
【问题描述】:

我正在使用this library 在 iOS 中使用 Swift 4 创建侧边菜单。

但是,这仅适用于 iPhone SE 或 5S 等较小的屏幕。在 iPhone 6 等更大的屏幕上,这不起作用,因为侧边菜单不会一直延伸到屏幕底部:

我在MainViewController 中创建侧边菜单的代码:

let menuLeftNavigationController = storyboard!.instantiateViewController(withIdentifier: "LeftMenuNavigationController") as! UISideMenuNavigationController
SideMenuManager.default.menuWidth = 260 
SideMenuManager.default.menuLeftNavigationController = menuLeftNavigationController
SideMenuManager.default.menuFadeStatusBar = false
SideMenuManager.default.menuPresentMode = .menuSlideIn
SideMenuManager.default.menuAnimationFadeStrength = 0.5
SideMenuManager.default.menuShadowOpacity = 0.8

// open with present
self.present(SideMenuManager.default.menuLeftNavigationController!, animated: true, completion: nil)

带有 SideMenu 的 ViewController:

【问题讨论】:

  • 您是否在情节提要中使用了自动布局约束?
  • 当我设置约束时,高度设置正确,但视图内的内容会出错。
  • 什么意思?您必须确保为视图的所有组件(例如您的标签、该图像等)添加正确的约束。
  • 我确实定位了所有组件并设置了所有约束。我会再试一次。
  • 您可以发布您的约束的屏幕截图以及“内部内容错误”的问题。

标签: ios swift xcode autolayout side-menu


【解决方案1】:

尝试设置前导、顶部、底部和宽度约束。

【讨论】:

    猜你喜欢
    • 2019-08-05
    • 2017-08-17
    • 2015-06-16
    • 2023-04-04
    • 2017-03-10
    • 1970-01-01
    • 2017-10-19
    • 2020-02-05
    • 2012-07-23
    相关资源
    最近更新 更多