Class: MotionPrime::TableDelegate
- Inherits:
-
Object
- Object
- MotionPrime::TableDelegate
show all
- Includes:
- DelegateMixin
- Defined in:
- motion-prime/sections/table/table_delegate.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
#clear_delegated, #delegated_by
Constructor Details
Returns a new instance of TableDelegate.
6
7
8
9
|
# File 'motion-prime/sections/table/table_delegate.rb', line 6
def initialize(options)
self.table_section = options[:section].try(:weak_ref)
@section_instance = table_section.to_s
end
|
Instance Attribute Details
#table_section ⇒ Object
Returns the value of attribute table_section.
4
5
6
|
# File 'motion-prime/sections/table/table_delegate.rb', line 4
def table_section
@table_section
end
|
Instance Method Details
#init_pull_to_refresh ⇒ Object
def dealloc
pp 'Deallocating table_delegate for ', @section_instance
super
end
16
17
18
19
20
21
|
# File 'motion-prime/sections/table/table_delegate.rb', line 16
def init_pull_to_refresh
return unless block = table_section.class.pull_to_refresh_block
table_section.add_pull_to_refresh do
table_section.instance_eval(&block)
end
end
|
#numberOfSectionsInTableView(table) ⇒ Object
23
24
25
|
# File 'motion-prime/sections/table/table_delegate.rb', line 23
def numberOfSectionsInTableView(table)
table_section.number_of_groups
end
|
69
70
71
|
# File 'motion-prime/sections/table/table_delegate.rb', line 69
def scrollViewDidEndDecelerating(scroll)
table_section.scroll_view_did_end_decelerating(scroll)
end
|
73
74
75
|
# File 'motion-prime/sections/table/table_delegate.rb', line 73
def scrollViewDidEndDragging(scroll, willDecelerate: will_decelerate)
table_section.scroll_view_did_end_dragging(scroll, willDecelerate: will_decelerate)
end
|
61
62
63
|
# File 'motion-prime/sections/table/table_delegate.rb', line 61
def scrollViewDidScroll(scroll)
table_section.scroll_view_did_scroll(scroll)
end
|
65
66
67
|
# File 'motion-prime/sections/table/table_delegate.rb', line 65
def scrollViewWillBeginDragging(scroll)
table_section.scroll_view_will_begin_dragging(scroll)
end
|
#tableView(table, heightForHeaderInSection: group) ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'motion-prime/sections/table/table_delegate.rb', line 27
def tableView(table, cellForRowAtIndexPath: index)
cur_call_time = Time.now.to_f
cur_call_offset = table.contentOffset.y
if @prev_call_time
time_delta = cur_call_time - @prev_call_time
offset_delta = cur_call_offset - @prev_call_offset
@deceleration_speed = offset_delta/time_delta
end
@prev_call_time = cur_call_time
@prev_call_offset = cur_call_offset
table_section.cell_for_index(index)
end
|