I'm having trouble finding a way to remove a 'ghost' back button (nothing but a blue back arrow) when I initialize my uinavigationcontroller with a custom uinavigationbar. When I click that back button, I then see my custom navigationbar, but I would like to not have to click that back button.
I've tried almost all other solutions, including setHidesBackButton, etc. and playing with the order in which I call these functions.
class TabsVC : UITabBarController {
func setupTabBar() {
// setup feed tab
let navVC = UINavigationController(navigationBarClass: NavBar.self, toolbarClass: nil)
self.navigationItem.setHidesBackButton(true, animated: false)
let feedVC = FeedVC()
navVC.pushViewController(feedVC, animated: false)
let feedIcon = UIImage.fontAwesomeIcon(name: .home, textColor: ColorConstants.baseColor, size: CGSize(width: 40, height: 40))
navVC.tabBarItem = UITabBarItem(title: "", image: feedIcon, tag: 1)
// other tabs stuff
}
class NavBar : UINavigationBar {
func prepare() {
let item = UINavigationItem(title: "")
let titleV = titleView()
item.titleView = titleV
item.hidesBackButton = true
item.setHidesBackButton(false, animated: false)
item.leftBarButtonItem = UIBarButtonItem(image: UIImage.fontAwesomeIcon(name: .userCircle, textColor: ColorConstants.baseColor, size: CGSize(width: 40, height: 40)), style: .plain, target: nil, action: nil)
item.leftBarButtonItem?.tintColor = .white
item.leftBarButtonItem?.action = #selector(moveToProfileScreen)
self.pushItem(item, animated: false)
}
I just want to be able to see my custom nav bar from the beginning, and not have to click an empty back button to see the nav bar. Thanks!
moveToProfileScreen()something more complex than popping off the current view controller?