Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The menu items label is not showing #645

Closed
RehanMuqeem opened this issue Jul 4, 2022 · 1 comment
Closed

The menu items label is not showing #645

RehanMuqeem opened this issue Jul 4, 2022 · 1 comment

Comments

@RehanMuqeem
Copy link

RehanMuqeem commented Jul 4, 2022

import UIKit
import Parchment

class InverterSmartVC: BaseVC {

// MARK: - Variables
private var viewModel: InverterSmartVM?

var viewController: [UIViewController] = []

let titles: [String] = ["SmartSettingVC",
                        "ReservePowerSettingVC",
                        "AlarmSettingVC",
                        "SwitchSettingVC"
                        ]
var pagingViewController = PagingViewController()

// MARK: - IBOutlets
@IBOutlet weak var navBar: CustomNavBar!
@IBOutlet weak var containerView: UIView!

// MARK: - View Life Cycle
override func viewDidLoad() {
super.viewDidLoad()
self.initialSetup()
self.setupHeaderView()
self.setupPagingController()
self.setupMenu()
self.setupColors()
self.setupFonts()
}

}

// MARK: - Extension Private Functions
extension InverterSmartVC {

private func initialSetup() {
    self.viewController = [
        createSmartSetting(), createSmartSetting(), createSmartSetting(), createSmartSetting()
    ]
}

private func setupHeaderView() {
    self.navBar.titleText = "SMSYNG 1150"
    self.navBar.subtitleText = "Bathroom"
    self.navBar.tapCallBack = { [weak self] success in
        if success {
            AppRouter.shared.popController(from: self?.tabBarController)
        } else {
        //            present info
        }
    }
}

private func setupPagingController() {
    self.pagingViewController.dataSource = self
    self.pagingViewController.select(index: 0)
    self.pagingViewController = PagingViewController(viewControllers: self.viewController)
    self.containerView.addSubview(pagingViewController.view)
    self.containerView.constrainToEdges(pagingViewController.view)
    self.pagingViewController.didMove(toParent: self)
    self.pagingViewController.reloadData()
}

private func setupMenu() {
    self.pagingViewController.indicatorOptions = .visible(height: 2, zIndex: Int.max, spacing: UIEdgeInsets.zero, insets: UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 10))
    self.pagingViewController.borderOptions = .hidden
}

private func setupColors() {
    self.pagingViewController.indicatorColor = AppColors.titleColor
    self.pagingViewController.borderColor = AppColors.titleColor
    self.pagingViewController.backgroundColor = .clear
    self.pagingViewController.menuBackgroundColor = .clear
    self.pagingViewController.textColor = AppColors.darkRed
    self.pagingViewController.selectedTextColor = AppColors.titleColor
}

private func setupFonts() {
    self.pagingViewController.font = AppFonts.Soleto_Regular.withSize(14.0)
    self.pagingViewController.selectedFont = AppFonts.Soleto_Medium.withSize(14.0)
}

func createSmartSetting() -> UIViewController {
    AppRouter.shared.getSmartSettingVC()
}

}

extension InverterSmartVC: PagingViewControllerDataSource {

func numberOfViewControllers(in pagingViewController: PagingViewController) -> Int {
    return self.viewController.count
}

func pagingViewController(_ pagingViewController: PagingViewController, viewControllerAt index: Int) -> UIViewController {
    return self.viewController[index]
}

func pagingViewController(_: PagingViewController, pagingItemAt index: Int) -> PagingItem {
    return PagingIndexItem(index: index, title: self.titles[index])
}

}

@rechsteiner
Copy link
Owner

Hi @RehanMuqeem! Sorry for the late response. Did you figure this out? I'm not really sure based on your code what is the problem here, but I suggest taking a look at the Example projects. Let me know if you still think this is a bug in Parchment and I can re-open it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants