UINavigationBar- this is UIWindow(not a UIView), which is higher UIWindowin which you act. Therefore, it is impossible to imagine UIViewsfrom yours UIWindow.
What you can do is add transparent in UIBarButtonItemaddition to your button, causing the same action:
var button = UIBarButtonItem(title: "", style: .Plain, target: action: #selector(yourAction(_:)))
button.tintColor = UIColor.clear
navigationController?.navigationItem.leftBarButtonItem = button
source
share