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

Problem with orientation change #33

Open
smamczak opened this issue May 8, 2017 · 3 comments · May be fixed by #40
Open

Problem with orientation change #33

smamczak opened this issue May 8, 2017 · 3 comments · May be fixed by #40

Comments

@smamczak
Copy link

smamczak commented May 8, 2017

Hi, I have 4 views with Labels. When I change orientation the view is in wrong position (I think the scroll view is responsible for this).

This is how it looks

and from landscape to portrait

I have managed to do some nasty hack with this code

var lastIndex = 0

func scrollPager(scrollPager: ScrollPager, changedIndex: Int) {
    print("scrollPager index changed: \(changedIndex)")
    lastIndex = changedIndex
}

override func willTransition(to newCollection: UITraitCollection, with coordinator: UIViewControllerTransitionCoordinator) {
    coordinator.animate(alongsideTransition: nil) { _ in
            
        self.scrollPager.setSelectedIndex(index: self.lastIndex, animated: false)
    }
}

It would be much better when selectedIndex property was public (the getter) than private because I wouldn't have to remember the index. Please fix this to scroll automatically to right view when orientation changes.

@aryaxt
Copy link
Owner

aryaxt commented May 9, 2017

Thanks for reporting. does this happen on the demo project?

@smamczak
Copy link
Author

smamczak commented May 9, 2017

@aryaxt yes

@cafedeichi
Copy link

@aryaxt
Hi, I fixed this issue. Hoping you could review my PR #40.

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

Successfully merging a pull request may close this issue.

3 participants