ios - 寻呼机选项卡隐藏在 ios swift 中 XLPagerTabStrip 的导航栏下。(使用 XLPagerTabStrip)
问题描述
我在 swift 4 应用程序中使用XLPagerTabStrip ,我使用collectionview并且一切正常,但按钮栏隐藏在导航栏后面。
我搜索了这个问题。所以我得到了这个链接和答案
XLPagerTabStrip ButtonBar 粘在导航栏后面
我编辑这个。我将collectionview 类设置为“ButtonBarView”。图片的链接是这个
图片链接:https ://i.stack.imgur.com/WjARH.png
然后将其插座与左侧面板中的视图连接
图片链接:https ://i.stack.imgur.com/uyFBr.png
但这对我不起作用。我搜索了另一个网站和问题。
链接:https ://github.com/xmartlabs/XLPagerTabStrip/issues/262
我用这个编辑我的代码。后
ViewDidLoad
添加以下代码
self.view.layoutIfNeeded()
buttonBarView.selectedBar.frame.origin.y = buttonBarView.frame.size.height - settings.style.selectedBarHeight
但它没有用。我的代码是
class medicationViewController: ButtonBarPagerTabStripViewController {
override func viewDidLoad() {
self.loaDesign()
super.viewDidLoad()
self.view.layoutIfNeeded()
buttonBarView.selectedBar.frame.origin.y = buttonBarView.frame.size.height - settings.style.selectedBarHeight
}
override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
let child_1 = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "apercuViewController")
let child_2 = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "nouveauViewController")
let child_3 = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "prescripViewController")
let child_4 = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "schemaViewController")
return [child_1,child_2,child_3,child_4]
}
func loaDesign() {
// change selected bar color
self.settings.style.selectedBarHeight = 2.0
self.settings.style.selectedBarBackgroundColor = UIColor(red: 0/255, green: 162/255, blue: 255/255, alpha: 1.0)
self.settings.style.buttonBarBackgroundColor = UIColor.white
self.settings.style.buttonBarItemBackgroundColor = UIColor.white
self.settings.style.buttonBarItemFont = UIFont(name: "Poppins", size: 14)!
self.settings.style.buttonBarItemTitleColor = .white
self.settings.style.buttonBarMinimumLineSpacing = 0
self.settings.style.buttonBarItemsShouldFillAvailiableWidth = true
self.settings.style.buttonBarLeftContentInset = 0
self.settings.style.buttonBarRightContentInset = 0
changeCurrentIndexProgressive = { (oldCell: ButtonBarViewCell?, newCell: ButtonBarViewCell?, progressPercentage: CGFloat, changeCurrentIndex: Bool, animated: Bool) -> Void in
guard changeCurrentIndex == true else { return }
oldCell?.label.textColor = UIColor.black
newCell?.label.textColor = UIColor(red: 0/255, green: 162/255, blue: 255/255, alpha: 1.0)
}
}
在子视图控制器中我的代码是
extension apercuViewController : IndicatorInfoProvider{
func indicatorInfo(for pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo {
return IndicatorInfo(title: "APERCU")
}
}
我想添加所有这些的图像,但他们不允许我。这里需要在集合视图下获取容器视图吗?我没有采取容器视图。
解决方案
推荐阅读
- laravel - Laravel 验证请求和 API 路由 POST 参数
- java - 我不能在数组上使用方法设置器 setMarcaCelular
- oracle - 甲骨文。日期数据类型的 CAST COLLECT
- python - 当我拥有文件内容时,应该将什么传递给需要文件名的函数?
- vue.js - 如何确保我的指令运行一个函数?
- google-bigquery - 使用适用于 Spark 的 BigQuery 连接器时,我可以发出查询而不是指定表吗?
- git - 包含一个项目的所有存储库的列表
- android - react native中Text组件的accessibility,accessibilityLabel和accessibilityHint属性有什么区别?
- angular - Openlayers 3:无法在 Angular 5 应用程序中选择功能
- javascript - 如何在 riot-lol-api npm 包中使用缓存?