2

I don't know why it is not swiping to the next viewController. Instead it swipes to a blank page and the tab slider also doesn't move. But when i click on the tabs it works fine and slides to the next viewController. Really not sure why its like this? Any help would be much appreciated. Thanks

import UIKit
import XLPagerTabStrip

class mainProfileViewController: ButtonBarPagerTabStripViewController {

        @IBOutlet weak var scrollView: UIScrollView!
        @IBOutlet weak var contentView: UIView!
        @IBOutlet weak var headerView: HeaderView!
        @IBOutlet weak var barView: ButtonBarView!
        @IBOutlet weak var viewContainer: UIScrollView!

    let grayColor = UIColor(red: 21/255.0, green: 21/255.0, blue: 24/255.0, alpha: 1.0)

        override func viewDidLoad() {

        settings.style.buttonBarBackgroundColor = grayColor
        settings.style.buttonBarItemBackgroundColor =
        grayColor
        settings.style.selectedBarBackgroundColor = UIColor.init(red: 14.0/255, green: 122.0/255, blue: 254.0/255, alpha: 1.0)
        settings.style.buttonBarItemFont = UIFont(name: "AppleSDGothicNeo-Bold", size:15) ?? UIFont.systemFont(ofSize: 18)
        settings.style.selectedBarHeight = 2.0
        settings.style.buttonBarMinimumLineSpacing = 0
        settings.style.buttonBarItemTitleColor = .red
        settings.style.buttonBarItemsShouldFillAvailableWidth = true
        settings.style.buttonBarHeight = 40
        settings.style.buttonBarLeftContentInset = 20
        settings.style.buttonBarRightContentInset = 20

        changeCurrentIndexProgressive = { (oldCell: ButtonBarViewCell?, newCell: ButtonBarViewCell?, progressPercentage: CGFloat, changeCurrentIndex: Bool, animated: Bool) -> Void in
            guard changeCurrentIndex == true else { return }
            oldCell?.label.textColor = UIColor(red: 138/255.0, green: 138/255.0, blue: 144/255.0, alpha: 1.0)
            newCell?.label.textColor = .white  
            }

            super.viewDidLoad()
        }

    override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {

        let child_1 = storyboard!.instantiateViewController(withIdentifier: "profilePhotoViewController") as! profilePhotoViewController
        let child_2 = storyboard!.instantiateViewController(withIdentifier: "profileVideoController") as! profileVideoController

        return [child_1, child_2]

    }
}

child_1 ViewController

class photosNewsfeedViewController: UIViewController, IndicatorInfoProvider {

    var itemInfo: IndicatorInfo = "Photos"

    override func viewDidLoad() {
        super.viewDidLoad()

    }

    func indicatorInfo(for pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo {

        return itemInfo
    }
}

child_2 ViewController

class videoNewsfeedViewController: UIViewController, IndicatorInfoProvider {

    var itemInfo: IndicatorInfo = "Videos"

    override func viewDidLoad() {
        super.viewDidLoad()

    }

    func indicatorInfo(for pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo {

        return itemInfo
    }
}
j.iese
  • 161
  • 1
  • 10

0 Answers0