Module: Turbo::VisitableView::RefreshControl

Included in:
Turbo::VisitableView
Defined in:
lib/turbo/visitable_view/refresh_control.rb

Instance Method Summary collapse

Instance Method Details

#allowsPullToRefreshObject



12
13
14
15
# File 'lib/turbo/visitable_view/refresh_control.rb', line 12

def allowsPullToRefresh
  return @allowsPullToRefresh if defined?(@allowsPullToRefresh)
  @allowsPullToRefresh = true
end

#allowsPullToRefresh=(allowsPullToRefresh) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/turbo/visitable_view/refresh_control.rb', line 17

def allowsPullToRefresh=(allowsPullToRefresh)
  @allowsPullToRefresh = allowsPullToRefresh
  if allowsPullToRefresh
    installRefreshControl
  else
    removeRefreshControl
  end
end

#isRefreshingObject



26
27
28
# File 'lib/turbo/visitable_view/refresh_control.rb', line 26

def isRefreshing
  refreshControl.refreshing?
end

#refresh(sender) ⇒ Object



30
31
32
# File 'lib/turbo/visitable_view/refresh_control.rb', line 30

def refresh(sender)
  visitable.visitableViewDidRequestRefresh if visitable
end

#refreshControlObject



4
5
6
7
8
9
10
# File 'lib/turbo/visitable_view/refresh_control.rb', line 4

def refreshControl
  @refreshControl ||= begin
    refreshControl = UIRefreshControl.alloc.init
    refreshControl.addTarget(self, action: "refresh:", forControlEvents: UIControlEventValueChanged)
    refreshControl
  end
end