Sha256: 202731689f1130b81803cda0d956f19b3c0c43f66c712c33d31903aed3f41efa
Contents?: true
Size: 841 Bytes
Versions: 4
Compression:
Stored size: 841 Bytes
Contents
module MotionPrime module TableSectionRefreshMixin def add_pull_to_refresh(options = {}, &block) screen.automaticallyAdjustsScrollViewInsets = false collection_view.addPullToRefreshWithActionHandler(block) # block must be a variable refresh_view = collection_view.pullToRefreshView options[:styles] ||= [] options[:styles] += [:base_pull_to_refresh] # pass yOrigin to override view top base_options = { alpha: 0, custom_offset_threshold: - collection_view.contentInset.top - refresh_view.size.height, original_top_inset: collection_view.contentInset.top } screen.set_options_for refresh_view, base_options.deep_merge(options) end def finish_pull_to_refresh reload_data collection_view.pullToRefreshView.stopAnimating end end end
Version data entries
4 entries across 4 versions & 1 rubygems