MoZhouqi / KMNavigationBarTransition

A drop-in universal library helps you to manage the navigation bar styles and makes transition animations smooth between different navigation bar styles while pushing or popping a view controller for all orientations. And you don't need to write any line of code for it, it all happens automatically.
MIT License
3.38k stars 455 forks source link

ios11 bug #101

Open axmav opened 6 years ago

axmav commented 6 years ago

Hello! I want to have dark background color on first table view controller and transparent background on second view controller. The result is following: ezgif com-video-to-gif 1

import UIKit

class TVCTableViewController: UITableViewController {

    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        let image = UIImage(color: .rktDark)
        navigationController?.navigationBar.barTintColor = .rktDark
        navigationController?.navigationBar.setBackgroundImage(image, for: .default)

        title = "TableViewController"  
    }

    // MARK: - Table view data source

    override func numberOfSections(in tableView: UITableView) -> Int {
        // #warning Incomplete implementation, return the number of sections
        return 1
    }

    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        // #warning Incomplete implementation, return the number of rows
        return 20
    }

    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)

        return cell
    }

    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        performSegue(withIdentifier: "ttt", sender: self)
    }

}
import UIKit

class TestViewController: UIViewController, UITableViewDataSource {

    @IBOutlet weak var tableView: UITableView!
    override func viewDidLoad() {
        super.viewDidLoad()
        tableView.dataSource = self
        navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
        navigationController?.navigationBar.shadowImage = UIImage()

    }

    func numberOfSections(in tableView: UITableView) -> Int {
        return 1
    }

    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 80
    }

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        return tableView.dequeueReusableCell(withIdentifier: "basic", for: indexPath)
    }

}

First view controller is transparent? Why?

MoZhouqi commented 6 years ago

Hi @Mazorati, I tried your code and it still looked normal, so could you give me the complete demo?