ios - 导航栏下的模态视图 Controller - Swift

标签 ios swift uiviewcontroller uinavigationcontroller uitabbarcontroller

我有这样的场景:

enter image description here

导航 Controller 中的一个选项卡栏。 在导航栏中有一个导航项(它是一个按钮)。 当我点击它时,我想显示一个模式 Controller ,该 Controller 在导航栏下方打开并覆盖选项卡栏。

我这样做了:

func tapButtonNavigationBar(){

     let search = self.storyboard?.instantiateViewController(withIdentifier: "search) as! SearchController
        self.present(search, animated: true, completion: nil)
}

但是,通过这段代码,新的“搜索” Controller 位于导航栏下方。 你能帮我吗?

最佳答案

我知道的一种方法是您可以添加指定帧的 subview 而不是 View Controller ,并使用动画打开相同的 subview 。

关于ios - 导航栏下的模态视图 Controller - Swift,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45525058/

相关文章:

ios - 如何使 WebView 在 iPhone/iPad Retina 中工作

ios - UICollectionView Cell Tapped 时显示按钮

swift - UITableView 中 CPU 使用率异常高

ios - View 设计未显示在 ViewController 中

ios - 按下按钮时 UIViewcontroller 不打开

ios - 适用于 IOS 的 Google Maps API map 显示为黑屏,左下角带有 Google Logo

ios - 发布 iOS 应用程序后,是否可以将部署目标从 iOS8 更改为 iOS7?

ios - 单击按钮时出现奇怪的错误(Swift Xcode)

iOS:UIView 不会停留在状态栏后面

swift - Swift 中标签词选择的动态弹出窗口