您好,我正在为 pager
使用 ButtonBarPagerTabStripViewController
,在段 Controller 索引更改时
我想隐藏 ButtonBarPagerTabStripViewController
的一个 subview Controller 。
我用过
覆盖 public func viewControllers(对于 pagerTabStripController:PagerTabStripViewController)-> [UIViewController] { }
此委托(delegate)方法在 ButtonBarPagerTabStripViewController
中添加 View Controller 。
如何隐藏 ButtonBarPagerTabStripViewController
的任何 subview Controller 。
最佳答案
要将你的 UIViewController
添加到你的 pagerTabStripController
你应该有类似的东西:
// MARK: - XLPagerTabStrip required override methods
override public func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
return buildViewControllers()
}
// Build the tabs in the tabBar.
func buildViewControllers() -> [UIViewController] {
// Add custom viewControllers here.
let aViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "YOUR_IDENTIFIER") as! YOUR_VIEW_CONTROLLER
let bViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "YOUR_IDENTIFIER") as! YOUR_VIEW_CONTROLLER
// Other...
return [aViewController, bViewController]
}
要隐藏特定的 UIViewController
,只需将其从 UIViewController
array 中移除,然后使用 reloadPagerTabStripView() 再次调用委托(delegate)方法
重新加载选项卡
关于swift - Ho 在段索引 chnage 上隐藏 ButtonBarPagerTabStripViewController 的 Childe View Controller,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50509073/