简体   繁体   中英

Swift - Large title transition with tableView

I'm trying to code the "Sign up" part of my app. I'm using Large Title for that. If I use normal ViewControllers, everything is good, but if I use TableViewController, I have a really bad transition when I change the ViewController:

在此处输入图片说明

I can see a black background. Do you have any idea about how I could correct this?

EDIT: If I set isTranslucent = true, it's okay, but I would like to have a white NavigationBar. Do you know how to do that?

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)
}

EDIT 2:

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

The NavigationBar is still translucent, even if the imageBackground is opaque ...

在此处输入图片说明

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM