Module: ProMotion::MotionTable::RefreshableTable
- Included in:
- GroupedTable, PlainTable, TableScreenModule
- Defined in:
- lib/ProMotion/screen_helpers/_tables/_refreshable_table.rb
Instance Method Summary collapse
- #end_refreshing ⇒ Object
- #make_refreshable(params = {}) ⇒ Object (also: #makeRefreshable)
-
#refreshView(refresh) ⇒ Object
UIRefreshControl Delegates.
- #start_refreshing ⇒ Object
Instance Method Details
#end_refreshing ⇒ Object
35 36 37 38 39 40 |
# File 'lib/ProMotion/screen_helpers/_tables/_refreshable_table.rb', line 35 def end_refreshing return unless @refresh_control @refresh_control.attributedTitle = NSAttributedString.alloc.initWithString(sprintf(@updated_format, Time.now.strftime(@updated_time_format))) @refresh_control.endRefreshing end |
#make_refreshable(params = {}) ⇒ Object Also known as: makeRefreshable
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/ProMotion/screen_helpers/_tables/_refreshable_table.rb', line 3 def make_refreshable(params={}) = params[:pull_message] || "Pull to refresh" @refreshing = params[:refreshing] || "Refreshing data..." @updated_format = params[:updated_format] || "Last updated at %s" @updated_time_format = params[:updated_time_format] || "%l:%M %p" @refreshable_callback = params[:callback]|| :on_refresh @refresh_control = UIRefreshControl.alloc.init @refresh_control.attributedTitle = NSAttributedString.alloc.initWithString() @refresh_control.addTarget(self, action:'refreshView:', forControlEvents:UIControlEventValueChanged) self.refreshControl = @refresh_control end |
#refreshView(refresh) ⇒ Object
UIRefreshControl Delegates
20 21 22 23 24 25 26 27 |
# File 'lib/ProMotion/screen_helpers/_tables/_refreshable_table.rb', line 20 def refreshView(refresh) refresh.attributedTitle = NSAttributedString.alloc.initWithString(@refreshing) if @refreshable_callback && self.respond_to?(@refreshable_callback) self.send(@refreshable_callback) else PM.logger.warn "You must implement the '#{@refreshable_callback}' method in your TableScreen." end end |
#start_refreshing ⇒ Object
29 30 31 32 33 |
# File 'lib/ProMotion/screen_helpers/_tables/_refreshable_table.rb', line 29 def start_refreshing return unless @refresh_control @refresh_control.beginRefreshing end |