0

Title image view position is changing while changing the tab in BubbleTabBarController. BubbleTabBarController

enter image description here

I have used following code to set the title view in navigation bar.

 func setOtherNavigation(){
  
    
    let navBar = self.navigationController!.navigationBar

    let standardAppearance = UINavigationBarAppearance()
    standardAppearance.configureWithOpaqueBackground()
    standardAppearance.backgroundImage = UIImage(named: "top_bar")

    let compactAppearance = standardAppearance.copy()
    compactAppearance.backgroundImage = UIImage(named: "top_bar")

    navBar.standardAppearance = standardAppearance
    navBar.scrollEdgeAppearance = standardAppearance
    navBar.compactAppearance = compactAppearance
  
    let imgLogo = UIImageView(frame: CGRect(x:  0, y: 0, width: 200 , height: 40))

    imgLogo.contentMode = .scaleAspectFit
    let imageLogo = UIImage(named: "logo")
    imgLogo.image = imageLogo
    self.navigationItem.titleView = imgLogo

    
}

Everything seems good at home tab bar. when I change the tab from home to category tab, it is the title image view moving little right from centre horizontal position. I don't know why it is happening. Any one know?

enter image description here

Noorul
  • 3,386
  • 3
  • 32
  • 54
  • Just from the images you've posted, it looks like the width of the title changes and the system shifts things around to accommodate the different widths. Perhaps you can show some images with fewer mashed together, overlapping images to help us help you? – Scott Thompson Oct 11 '21 at 14:51
  • Thank you for the comment @ScottThompson I have used https://stackoverflow.com/a/49841817/3026347 this link to make my things work. – Noorul Oct 11 '21 at 14:58
  • thanks to https://stackoverflow.com/users/1125156/danfordham – Noorul Oct 11 '21 at 14:59

0 Answers0