ProMotion
ProMotion copied to clipboard
Idea: add "on_stopped_scrolling" and "on_scroll" to PM::TableScreen
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?
I like it! :+1:
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
@bmichotte Yes! Also, we could give an optional parameter for velocity.
http://stackoverflow.com/a/9705218/204044
Nice idea.
:+1: So is there any ETA on this?
Feel free to tackle it, @edenvicary ! I don't intend to anytime soon, so it's a great way to contribute.
@afestein could be a good way to clean up some of that code.