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

Idea: add "on_stopped_scrolling" and "on_scroll" to PM::TableScreen #640

Open
jamonholmgren opened this issue Mar 4, 2015 · 7 comments
Open

Comments

@jamonholmgren
Copy link
Owner

  def scrollViewDidEndDecelerating(_)
    try :on_stopped_scrolling
  end

  def scrollViewDidEndDragging(_, willDecelerate: decelerate)
    try :on_stopped_scrolling unless decelerate
  end

  def scrollViewDidScroll(_)
    try :on_scroll
  end

What think ye?

@markrickert
Copy link
Contributor

I like it! 👍

@bmichotte
Copy link
Contributor

In addition to this, and referring this question... why not implement this way ?

def scrollViewDidScroll(scroll_view)
   current_y = scroll_view.contentOffset.y
   @previous_y ||= 0

   if self.respond_to?(:on_scroll)
      try :on_scroll
   elsif current_y > @previous_y 
      try :on_scroll_down
   else
      try :on_scroll_up
   end

  # keep track of current_y 
  @previous_y = current_y
end

@jamonholmgren
Copy link
Owner Author

@bmichotte Yes! Also, we could give an optional parameter for velocity.

http://stackoverflow.com/a/9705218/204044

@bmichotte
Copy link
Contributor

Nice idea.

@edenvicary
Copy link

👍 So is there any ETA on this?

@jamonholmgren
Copy link
Owner Author

Feel free to tackle it, @edenvicary ! I don't intend to anytime soon, so it's a great way to contribute.

@edenvicary
Copy link

@afestein could be a good way to clean up some of that code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants