From 45d726133cb6e9527d587b383b4f0eac4cd670b9 Mon Sep 17 00:00:00 2001 From: Mark Rickert Date: Mon, 6 May 2013 19:38:18 -0400 Subject: [PATCH] Add a warning if the user didn't implement the on_refresh method or they specified a callback method but didn't implement it. --- lib/ProMotion/screen_helpers/_tables/_refreshable_table.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ProMotion/screen_helpers/_tables/_refreshable_table.rb b/lib/ProMotion/screen_helpers/_tables/_refreshable_table.rb index ee9792a..3dcce4b 100644 --- a/lib/ProMotion/screen_helpers/_tables/_refreshable_table.rb +++ b/lib/ProMotion/screen_helpers/_tables/_refreshable_table.rb @@ -19,7 +19,11 @@ module ProMotion::MotionTable # UIRefreshControl Delegates def refreshView(refresh) refresh.attributedTitle = NSAttributedString.alloc.initWithString(@refreshing) - self.send(@refreshable_callback) if @refreshable_callback + if @refreshable_callback && self.respondsToSelector(@refreshable_callback) + self.send(@refreshable_callback) + else + ProMotion::Console.log("ProMotion Warning: you must implement an on_refresh method in your TableScreen.", with_color: ProMotion::Console::RED_COLOR) + end end def start_refreshing