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

Possible to change position of the menu to bottom of screen? #130

Closed
saldous opened this issue Feb 10, 2018 · 3 comments
Closed

Possible to change position of the menu to bottom of screen? #130

saldous opened this issue Feb 10, 2018 · 3 comments

Comments

@saldous
Copy link

saldous commented Feb 10, 2018

Is it possible to change the position of the menu to the bottom of the screen?

@rechsteiner
Copy link
Owner

Yes! There is not built in options for that, but you can subclass PagingView and override setupConstraints like this:

class CustomPagingView : PagingView {
  override func setupConstraints() {
    pageView.translatesAutoresizingMaskIntoConstraints = false
    collectionView.translatesAutoresizingMaskIntoConstraints = false
    
    NSLayoutConstraint.activate([
      pageView.leadingAnchor.constraint(equalTo: leadingAnchor),
      pageView.trailingAnchor.constraint(equalTo: trailingAnchor),
      pageView.topAnchor.constraint(equalTo: collectionView.topAnchor),
      pageView.bottomAnchor.constraint(equalTo: bottomAnchor),
      
      collectionView.leadingAnchor.constraint(equalTo: leadingAnchor),
      collectionView.trailingAnchor.constraint(equalTo: trailingAnchor),
      collectionView.bottomAnchor.constraint(equalTo: bottomAnchor),
      collectionView.heightAnchor.constraint(equalToConstant: options.menuItemSize.height),
    ])
  }
}

class CustomPagingViewController : FixedPagingViewController {
  override func loadView() {
    view = CustomPagingView(
      options: options,
      collectionView: collectionView,
      pageView: pageViewController.view)
  }
}

@saldous
Copy link
Author

saldous commented Feb 14, 2018

Great, thank you!

@igorkaryi
Copy link

how to do this for PagingViewControllerDelegate

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

3 participants