当 XLPagerTabStrip 在第一个子视图控制器中加载视图时,会从两侧留出空间,但如果我切换选项卡,那么它会根据需要获取屏幕。
这是一个模拟器的截图,便于理解:
切换选项卡后,它显示全角视图[如预期的那样]:
我的整个设置是正常的 tableview 没有做任何事情,因为它只是一个视图,这里是 XKPager 设置
settings.style.buttonBarBackgroundColor = appBlueColor
settings.style.buttonBarItemBackgroundColor = appBlueColor
settings.style.selectedBarBackgroundColor = appBrownColor
settings.style.buttonBarItemFont = UIFont.appRegularFontWith(size: 16)
settings.style.selectedBarHeight = 4.0
settings.style.buttonBarMinimumLineSpacing = 0
settings.style.buttonBarItemTitleColor = .black
settings.style.buttonBarItemsShouldFillAvailableWidth = true
settings.style.buttonBarLeftContentInset = 0
settings.style.buttonBarRightContentInset = 0
changeCurrentIndexProgressive = { [weak self] (oldCell: ButtonBarViewCell?, newCell: ButtonBarViewCell?, progressPercentage: CGFloat, changeCurrentIndex: Bool, animated: Bool) -> Void in
guard changeCurrentIndex == true else { return }
oldCell?.label.textColor = self?.oldCellColor
oldCell?.label.font = UIFont.appRegularFontWith(size: 16)
newCell?.label.textColor = .white
newCell?.label.font = UIFont.appMediumFontWith(size: 16)
}
override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
let child1 = UIStoryboard(name: "Home", bundle: nil).instantiateViewController(withIdentifier: "childViewController1")
let child2 = UIStoryboard(name: "Home", bundle: nil).instantiateViewController(withIdentifier: "childViewController1")
let child3 = UIStoryboard(name: "Home", bundle: nil).instantiateViewController(withIdentifier: "childViewController1")
return [child1, child2, child3]
}
Xcode 版本:11.2.1
swift 版本:5
ios 部署目标:10.0
XLPager 已更新