【问题标题】:issue with XLPagerTabStrip while implementing in my app在我的应用程序中实施时 XLPagerTabStrip 出现问题
【发布时间】:2021-01-28 11:39:10
【问题描述】:

我在我的应用程序中使用Swift 创建我正在实施XLPagerTabStrip,我在下面的博客中提到要实施这里是链接

This is the reference link

一切都很完美,尽管当我导航到主屏幕然后XLPagerTabStrip 显示在状态栏上是屏幕截图我得到什么类型的输出

This is the screen shot of output which i am getting

This is expected output i want something like this

This is storyboard screenshot

这是我的控制器代码

import UIKit
import XLPagerTabStrip

class HomeViewController: ButtonBarPagerTabStripViewController {

    //MARK: - VARIABLEs
    
    //MARK: - OUTLETs
    
    //MARK: - VOID METHODs
    
    override func viewDidLoad() {
        configureButtonBar()
        super.viewDidLoad()
        // Do any additional setup after loading the view.
    }
    
    //MARK: - CLICKED EVENTs
    
    //MARK: - FUNCTIONs
    func configureButtonBar() {
        settings.style.buttonBarBackgroundColor = .white
        settings.style.buttonBarItemBackgroundColor = .white

        settings.style.buttonBarItemFont = UIFont(name: "Roboto-Medium", size: 14.0)!
        settings.style.buttonBarItemTitleColor = UIColor(red: 84/255, green: 84/255, blue: 84/255, alpha: 1)
        
        settings.style.buttonBarMinimumLineSpacing = 0
        settings.style.buttonBarItemsShouldFillAvailableWidth = true
        settings.style.buttonBarLeftContentInset = 0
        settings.style.buttonBarRightContentInset = 0

        settings.style.selectedBarHeight = 3.0
        settings.style.selectedBarBackgroundColor = UIColor(red: 112/255, green: 112/255, blue: 112/255, alpha: 1)
        
        // Changing item text color on swipe
        changeCurrentIndexProgressive = { [weak self] (oldCell: ButtonBarViewCell?, newCell: ButtonBarViewCell?, progressPercentage: CGFloat, changeCurrentIndex: Bool, animated: Bool) -> Void in
            guard changeCurrentIndex == true else { return }
            oldCell?.label.textColor = UIColor(red: 84/255, green: 84/255, blue: 84/255, alpha: 1)
            newCell?.label.textColor = UIColor(red: 112/255, green: 112/255, blue: 112/255, alpha: 1)
        }
    }
    
    override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
        let child1 = UIStoryboard.init(name: "Functional", bundle: nil).instantiateViewController(withIdentifier: "FeedViewController") as! FeedViewController
        
        let child2 = UIStoryboard.init(name: "Functional", bundle: nil).instantiateViewController(withIdentifier: "ArticlesViewController") as! ArticlesViewController
        
        return [child1, child2]
    }
}

我所做的一切都与演示应用程序中提供的相同,但仍然 XLPagerTabStrip 覆盖状态栏和包含通知和菜单图标的视图

正如您在故事板屏幕截图中看到的那样,我添加了菜单和通知图标,但XLPagerTabStrip 在运行应用程序时覆盖了整个视图

谁能知道为什么会这样,请给我建议

【问题讨论】:

    标签: ios swift uicollectionview uiscrollview xlpagertabstrip


    【解决方案1】:

    请阅读官方团队的博客。 XLPagerTabStrip tutorial

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-29
      相关资源
      最近更新 更多