eggswift / ESTabBarController

:octocat: ESTabBarController is a Swift model for customize UI, badge and adding animation to tabbar items. Support lottie!
MIT License
5.17k stars 578 forks source link

addChild(controller) 时 self.selectedIndex = 0 无效 #246

Closed CoderXSLee closed 1 year ago

CoderXSLee commented 3 years ago

func setupChild( title: String, image: String, selectedImage: String, vc: UIViewController.Type) { let item = ESTabBarItem.init(BouncesContentView(), title: title, image: UIImage(named: image), selectedImage: UIImage(named: selectedImage)) item.contentView?.renderingMode = .automatic let controller = UINavigationController(rootViewController: vc.init()) controller.tabBarItem = item addChild(controller) } 默认无选中item 执行 self.selectedIndex = 0 也无效 只有在ESTabBarController 82行断点的时候,查看self.tabBar 时是选中的,过了断点也就正常了,不打断点就不会选中! 为什么呢?

CoderXSLee commented 3 years ago

有没有大佬遇到过?