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

@kunass2

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?

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