0

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

这是参考链接

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

这是我得到的输出的屏幕截图

这是预期的输出我想要这样的东西

这是故事板截图

这是我的控制器代码

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在运行应用程序时覆盖了整个视图

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

4

1 回答 1

1

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

于 2020-10-14T07:38:50.060 回答