Open frank61003 opened 4 years ago
I don’t think this has anything to do with the tab bar. What library are you using for that segment control?
I use the apple original segment control and write an extension function for moving the bottombar. I found a workaround for this issue. I setBar hidden again in viewDidAppear and the bottombar position is correct. If I put setBar() before moveButtonBar() the button bar still reset to first segment selection. I also print the bottombar positin X in the viewDidDisappear, X position changes after go into mainViewController which tabar set hidden = true in viewDidAppear(please see the demo video in first comment). I supposedly the tabbar hidden change will draw the layout and reset buttonbar position(I know this situation is weird...). I report this issue just want to learn new thing for coding. AZTabBarController is really a nice third party kit. demo video: https://youtu.be/FCrVNhnXCEE
works fine
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
setBackgroundImage()
currentTabBar?.setBar(hidden: false, animated: false)
productSegment.moveButtonBar(buttonBar: buttonBar)
}
or
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
currentTabBar?.setBar(hidden: false, animated: false)
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
setBackgroundImage()
productSegment.moveButtonBar(buttonBar: buttonBar)
}
can't works
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
setBackgroundImage()
productSegment.moveButtonBar(buttonBar: buttonBar)
currentTabBar?.setBar(hidden: false, animated: false)
}
or
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
currentTabBar?.setBar(hidden: false, animated: false)
productSegment.moveButtonBar(buttonBar: buttonBar)
}
Hi, I use the tab bar and hide it in my main view(first tab), and use self.currentTabBar?.setBar(hidden: false, animated: false) in main view's viewDidDissapear(). I also set some segment with button bar in other tab view. The issue is that my button bar reset to the first segment position. My button bar works fine when I change tab with tapping tab bar. I try many times and found that issue supposedly happen when tabBar hidden is changing. Is some way to correct this issue? Demo video: https://youtu.be/V6lD-40gNpw
`