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

标题: ios - 当 isTranslucent = False (Swift 3) 时,导航栏会展开 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 19:48
标题: ios - 当 isTranslucent = False (Swift 3) 时,导航栏会展开

我有一个带有搜索栏的表格 View 。但是,当我单击搜索栏时,导航栏似乎会展开并在其下方创建一个空白区域。但是,这只发生在 self.navigationController?.navigationBar.isTranslucent = false 但是当我评论这一行时,空白永远不会出现。此外,只有当我按下搜索栏时才会出现白条。以下是一些图片供引用:

  1. 这是我不按搜索栏的时候。
  2. 然后,当我按下搜索栏时,其下方会出现一个空白。
  3. 然后当我取消搜索栏时,导航栏和搜索栏之间会出现空白。

This is when I don't press the search bar.

Then when I press the search bar a white space appears under it.

And then when I cancel out of the search bar the white space is between the navigation bar and the search bar.



Best Answer-推荐答案


viewDidLoad中加入这一行:

 self.automaticallyAdjustsScrollViewInsets = false

关于ios - 当 isTranslucent = False (Swift 3) 时,导航栏会展开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44373419/






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