PagingMenuController icon indicating copy to clipboard operation
PagingMenuController copied to clipboard

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

Open kunass2 opened this issue 6 years ago • 3 comments

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?

kunass2 avatar Nov 22 '17 14:11 kunass2

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

robertlechowicz avatar Nov 22 '17 15:11 robertlechowicz

I already made a fix and it was merged to master. https://github.com/kitasuke/PagingMenuController/pull/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'

t avatar Nov 22 '17 19:11 t

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

kunass2 avatar Nov 27 '17 12:11 kunass2