ios - Swift - 使用 tableView 的大标题过渡

标签 ios swift swift3 transition

我正在尝试对我的应用程序的“注册”部分进行编码。 我为此使用大标题。如果我使用普通的 ViewController,一切都很好,但如果我使用 TableViewController,当我更改 ViewController 时,我的过渡非常糟糕:

enter image description here

我可以看到黑色背景。您知道我该如何纠正这个问题吗?

编辑:如果我设置 isTranslucent = true,没关系,但我想要一个白色的导航栏。你知道该怎么做吗?

override func viewDidLoad(){
   super.viewDidLoad()
   if #available(iOS 11.0, *) {
         // tableView.contentInsetAdjustmentBehavior = .never
         self.navigationController?.navigationBar.prefersLargeTitles = true
      }
      self.navigationController?.navigationBar.isTranslucent = false

      self.navigationController?.navigationBar.shadowImage = UIImage()
}

@IBAction func continueAction(_ sender: Any) {
      let signupSecondVC = self.storyboard?.instantiateViewController(withIdentifier: "SignupSecondViewController") as! SignupSecondViewController
      self.navigationController?.pushViewController(signupSecondVC, animated: true)
}

编辑2:

let img = UIImage(named: "backgroundNav")
navigationController?.navigationBar.setBackgroundImage(img, for: .default)

导航栏仍然是半透明的,即使 imageBackground 是不透明的......

enter image description here

最佳答案

将导航栏的 isTranslucent 设置为 true 并通过其 backgroundImage 控制其颜色.

关于ios - Swift - 使用 tableView 的大标题过渡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50453773/

相关文章:

ios - Swift:使用 didSet 进行数组细粒度观察

ios - APNS 静默远程通知未触发 - SWIFT 3

ios - 如何在行的 TableView 单元格内的另一个数组内迭代数组

iphone - 如何在不激活 UISearchDisplayController 的情况下在 UISearchBar 中设置文本

ios - iPhone:从位置管理器或 map 工具包获取国家/地区代码

ios - 更新了 Parse SDK,获取 "' init( PFFile 为 )' is unavailable"

swift - 如何比较 NSDate 以检查日期是否在同一周内

ios - UIScrollView 以编程方式居中可调整大小的 View

ios - 在 Haneke 和 SwiftyJSON 之间转换 JSON

ios - 如何在 Xcode 项目中将字典数组写入 .txt 文件