I want to change the navigation bar position. After changing the position my back button action is not working. Actually I have added the navigation bar in my custom view controller. I want to change the navigation bar Y position. If I give negative value, back button action is not working and it works for any positive values(0..n). How can I make the back button action after changing the negative values for the navigation bar position.
let bounds = self.navigationController!.navigationBar.bounds
self.navigationController?.navigationBar.frame = CGRect(x: 0, y: -50, width: bounds.width, height: bounds.height)
self.navigationController?.navigationBar.backgroundColor = UIColor.gray
let button = UIButton(type: .custom)
button.addTarget(self, action: #selector(btnAction), for: .touchUpInside)
button.frame = CGRect(x:0, y:0, width:32, height:32)
button.backgroundColor = UIColor.green
let barButton = UIBarButtonItem(customView: button)
self.navigationController?.navigationItem.backBarButtonItem = barButton