ios - swift - 如何在导航 Controller 中制作尺寸高度 View ?

标签 ios swift storyboard

我想忽略导航栏并在导航 Controller 中显示全尺寸 View 。 但是 View 显示在导航栏下方。 我可以将导航栏与黑色 View 重叠吗?

enter image description here

我想做成这样的图片 enter image description here

最佳答案

要实现给定的 UI,您应该在窗口上添加顶 View 。为此,首先制作顶 View 的 xib。然后添加给定的代码:

    let frame = UIApplication.shared.keyWindow?.frame
    let wrapper = UIView(frame: frame!)
    wrapper.backgroundColor = UIColor.black.withAlphaComponent(0.35)

    let objView = YourView() // Create your view object here.
    objView.frame = wrapper.frame
    objView.center = wrapper.center
    wrapper.addSubview(objView)

    UIApplication.shared.keyWindow?.addSubview(wrapper)

根据您的要求设置YourView 的框架。 wrapper 使您的 View 透明。您可以在没有 wrapper 的情况下制作单一 View 。使用相同的代码在窗口上添加 View 。

关于ios - swift - 如何在导航 Controller 中制作尺寸高度 View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50385079/

相关文章:

ios - 在 tableView 单元格上播放视频的最佳做法是什么?

ios - 用选择器覆盖方法“tableview :cellForRowAtIndexPath

ios - 如何通过 Swift for iOS 调用不同的 Storyboard?

iphone - 图标尺寸不符合尺寸要求 (0x0)

ios - 模拟器 10.2.1 命令 + R 在 react native 中不起作用

ios - 将变量从 UIViewController 传递到自定义 UITableViewCell

ios - Xcode 6 中 Storyboard 中的 "Constrain to margin"是什么

ios - 在 Storyboard 中使用 AutoLayout 在 Table View Cell 中显示图像

ios - UIWebView的动态高度

ios - AF 网络 2.0 : credentials not sent to authentication within 30 seconds of previous request