Skip to content
This repository was archived by the owner on Jun 17, 2018. It is now read-only.
This repository was archived by the owner on Jun 17, 2018. It is now read-only.

Navigation after switched to right tab moves to the right side. #371

Open

Description

@kunass2

This is what i do in the app:

private struct PagingMenuControllerOptions: PagingMenuControllerCustomizable {
    var lazyLoadingPage: LazyLoadingPage {
        return .all
    }
    var backgroundColor: UIColor {
        return .clear
    }
    var componentType: ComponentType
}

private struct MenuItem: MenuItemViewCustomizable {
    private var title = "..."
    var horizontalMargin: CGFloat {
        return 15
    }
    var displayMode: MenuItemDisplayMode {
        return .text(title: MenuItemText(text: title,
                                         color: .lightGrey,
                                         selectedColor: .white,
                                         font: .contentTextLarge,
                                         selectedFont: .contentTextLarge))
    }
    init(title: String) {
        self.title = title
    }
}

private struct MenuOptions: MenuViewCustomizable {
    var backgroundColor: UIColor {
        return .clear
    }
    var selectedBackgroundColor: UIColor {
        return .clear
    }
    var height: CGFloat {
        return 27
    }
    var displayMode: MenuDisplayMode {
        return .standard(widthMode: .flexible, centerItem: false, scrollingMode: .scrollEnabledAndBouces)
    }
    var focusMode: MenuFocusMode {
        return .underline(height: 3, color: .white, horizontalPadding: 15, verticalPadding: 0)
    }
    var itemsOptions: [MenuItemViewCustomizable]
}

and this is how I implement it:

func setupPageMenu(with controllers: [UIViewController]) {
    let menuItems = controllers.map { MenuItem(title: $0.title ?? "...") }
    let menuOptions = MenuOptions(itemsOptions: menuItems)
    let options = PagingMenuControllerOptions(componentType: .all(menuOptions: menuOptions, pagingControllers: controllers))
    pageMenu = PagingMenuController(options: options)
    addSubview(pageMenu.view)
    pageMenu.view.snp.makeConstraints { make in
        make.bottom.equalToSuperview()
        make.top.equalTo(navigationBar.snp.bottom).offset(Constants.PageView.top)
        make.leading.equalTo(Constants.PageView.leading)
        make.trailing.equalTo(Constants.PageView.trailing)
    }
}

What is wrong. Why it moves to the right side?

Activity

  1. robertlechowicz commented on Nov 22, 2017

    @robertlechowicz

    Hi, I have similar problem, is there any way to change this behaviour?

  2. t commented on Nov 22, 2017

    @t
    Contributor

    I already made a fix and it was merged to master. #333

    Unfortunately, it seems new version has not been released yet after it was merged. However, you can use master branch anyway.

    If you use cocoapods, below should works.

    pod 'PagingMenuController',:git => 'https://github.com/kitasuke/PagingMenuController.git'
    
  3. kunass2 commented on Nov 27, 2017

    @kunass2
    Author

    Why dont you release it to cocoapods? you need to change the tag to 2.3 and run pod trunk push

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions