Open nesalexy opened 3 years ago
Hello, i have added XLPagerTabStrip from swift package https://github.com/xmartlabs/XLPagerTabStrip/issues/771#issuecomment-702104377 .My code looks like this:
import UIKit import XLPagerTabStrip class MainVC: ButtonBarPagerTabStripViewController, Storyboarded { var coordinator: AuthorizedCoordinator? let blueInstagramColor = UIColor(red: 37/255.0, green: 111/255.0, blue: 206/255.0, alpha: 1.0) override func viewDidLoad() { // change selected bar color settings.style.buttonBarBackgroundColor = UIColor.white settings.style.buttonBarItemBackgroundColor = UIColor.white settings.style.selectedBarBackgroundColor = blueInstagramColor //settings.style.buttonBarItemFont = .boldSystemFont(ofSize: 14) settings.style.selectedBarHeight = 2.0 settings.style.buttonBarMinimumLineSpacing = 0 settings.style.buttonBarItemTitleColor = UIColor.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 = .black newCell?.label.textColor = self?.blueInstagramColor } super.viewDidLoad() } // MARK: - PagerTabStripDataSource override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] { let child_2 = ChildExampleViewController(itemInfo: "YOU") let child_1 = ChildExampleViewController(itemInfo: "ME") return [child_1, child_2] }
ChildExampleViewController from XLPagerTabStrip example:
import UIKit import XLPagerTabStrip class ChildExampleViewController: UIViewController, IndicatorInfoProvider { var itemInfo: IndicatorInfo = "View" init(itemInfo: IndicatorInfo) { self.itemInfo = itemInfo super.init(nibName: nil, bundle: nil) } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } override func viewDidLoad() { super.viewDidLoad() let label = UILabel() label.translatesAutoresizingMaskIntoConstraints = false label.text = "XLPagerTabStrip" view.addSubview(label) view.backgroundColor = .white view.addConstraint(NSLayoutConstraint(item: label, attribute: .centerX, relatedBy: .equal, toItem: view, attribute: .centerX, multiplier: 1, constant: 0)) view.addConstraint(NSLayoutConstraint(item: label, attribute: .centerY, relatedBy: .equal, toItem: view, attribute: .centerY, multiplier: 1, constant: -50)) } // MARK: - IndicatorInfoProvider func indicatorInfo(for pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo { return itemInfo } }
My VC in storyboard
When i run the project i have en error: **Thread 1: "Could not load NIB in bundle: 'NSBundle (loaded)' with name 'ButtonCell'"**
**Thread 1: "Could not load NIB in bundle: 'NSBundle (loaded)' with name 'ButtonCell'"**
Please give to me advice how i can fix this issue
Are you using 9.0.0 with Swift 5 support?
I am, and it seems that reverting to 8.1.1 fixed my issue. Probably the library supports swift 5 but my project is old and it doesn't support it yet.
Hello, i have added XLPagerTabStrip from swift package https://github.com/xmartlabs/XLPagerTabStrip/issues/771#issuecomment-702104377 .My code looks like this:
ChildExampleViewController from XLPagerTabStrip example:
My VC in storyboard
When i run the project i have en error:
**Thread 1: "Could not load NIB in bundle: 'NSBundle (loaded)' with name 'ButtonCell'"**
Please give to me advice how i can fix this issue