fortmarek / SwipeViewController

SwipeViewController is a Swift modification of RKSwipeBetweenViewControllers - navigate between pages / ViewControllers
MIT License
655 stars 46 forks source link

It's too dangerous to use too much hardcode to judge the direction of scrollView #5

Closed EkkoG closed 8 years ago

EkkoG commented 8 years ago

As you can see,in theSwipViewController's changeButtonColor method,there are too much hard code to judge the direction of the scrollView,there are many if else things,and all of these if else do not cover all scope,you just consider the scope from -374 to 374,so how it work on iPhone 6 plus,iPhone 6 plus's screen width is 414,it is out of the scope you considered.

I think this issue maybe has a better solution,like this https://stackoverflow.com/questions/2543670/finding-the-direction-of-scrolling-in-a-uiscrollview How about you?

fortmarek commented 8 years ago

The thing is just the direction won't do it since I need to change the color exactly halfway through the animation. But it's true that the values are hardcoded, kind of didn't struck me to support there other sizes (silly me - I really should have thought of it). Will look into how to change that, thanks for the suggestion.

EkkoG commented 8 years ago

Yeah,this solution is a bit verbose,because you should write code for different size screen,I think the stackoverflow solution is better because you can write code once,but for all size of screen it can work well. I'm working on a simuliar project,it also has a simuliar animation,but the project only has few customize feature https://github.com/cielpy/CPYPagerViewController

fortmarek commented 8 years ago

New 0.1.1 release uses more abstract values to work with all screen sizes. I might do some more refactoring in the future but this version should do for now. Let me know if there is something specific you'd change.

EkkoG commented 8 years ago

Thanks

On Tuesday, 29 March 2016, Marek Fořt notifications@github.com wrote:

New 0.1.1 release uses more abstract values to work with all screen sizes. I might do some more refactoring in the future but this version should do for now 👍

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/fortmarek/SwipeViewController/issues/5#issuecomment-202487785