How to change the size of titleView in navigation bar. Because there's a gap between titleView and backButton in navigationBar

后端 未结 3 669
清歌不尽
清歌不尽 2021-01-02 12:46

I\'ve added a search bar to my navigation.titleView

    self.navigationItem.titleView = searchBar

There\'s also a BackBarButtonItem with ti

3条回答
  •  礼貌的吻别
    2021-01-02 13:44

    You can't do that, there is a default space given which we cannot change if we have back button.

     self.navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil)
            self.navigationController?.navigationBar.backIndicatorImage = UIImage(named: "back")
    
        self.navigationController?.navigationBar.backIndicatorTransitionMaskImage = UIImage(named: "back")
    
        self.navigationController?.navigationBar.tintColor = UIColor.lightGray
    

    Below is the screenshot

提交回复
热议问题