EGOTableViewPullRefresh with infinite-scrolling superpowers for RubyMotion.
NOTE: The example app is based on the demo app "Tweets" from the HipByte's RubyMotionSamples.
# Inherit all the magic
class TweetsController < RefreshableTableViewController
# ...
def viewDidLoad
# Must call super to allow Refreshable load its initial setup
super
# ...
end
end
def viewDidLoad
# ...
# Get older tweets when scrolling reaches bottom of table view
@callbacks[:infinite_scroll] = lambda {
get_tweets(max_id: @tweets.lastObject.id) if @tweets.lastObject
}
end
# Override pull to refresh handler to download new tweets
def refreshTableHeaderDidTriggerRefresh(view)
get_tweets(since_id: @tweets.first.id) if @tweets.first
end
def your_downloader_callback
# ...
# Stop pull-to-refresh loading animation
doneReloadingTableViewData
end
References and attributions: