Class: MotionPrime::CollectionDelegate
- Inherits:
-
Object
- Object
- MotionPrime::CollectionDelegate
show all
- Includes:
- DelegateMixin
- Defined in:
- motion-prime/sections/collection/collection_delegate.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
#clear_delegated, #delegated_by
Constructor Details
Returns a new instance of CollectionDelegate.
6
7
8
9
10
|
# File 'motion-prime/sections/collection/collection_delegate.rb', line 6
def initialize(options)
self.collection_section = options[:section].try(:weak_ref)
@_section_info = collection_section.to_s
@section_instance = collection_section.to_s
end
|
Instance Attribute Details
#collection_section ⇒ Object
Returns the value of attribute collection_section.
4
5
6
|
# File 'motion-prime/sections/collection/collection_delegate.rb', line 4
def collection_section
@collection_section
end
|
Instance Method Details
#collectionView(table, didSelectItemAtIndexPath: index) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'motion-prime/sections/collection/collection_delegate.rb', line 21
def collectionView(table, cellForItemAtIndexPath: 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
collection_section.cell_for_index(index)
end
|
#dealloc ⇒ Object
12
13
14
15
|
# File 'motion-prime/sections/collection/collection_delegate.rb', line 12
def dealloc
Prime.logger.dealloc_message :collection_delegate, @_section_info
super
end
|
#numberOfSectionsInCollectionView(table) ⇒ Object
17
18
19
|
# File 'motion-prime/sections/collection/collection_delegate.rb', line 17
def numberOfSectionsInCollectionView(table)
collection_section.number_of_groups
end
|
56
57
58
|
# File 'motion-prime/sections/collection/collection_delegate.rb', line 56
def scrollViewDidEndDecelerating(scroll)
collection_section.scroll_view_did_end_decelerating(scroll)
end
|
60
61
62
|
# File 'motion-prime/sections/collection/collection_delegate.rb', line 60
def scrollViewDidEndDragging(scroll, willDecelerate: will_decelerate)
collection_section.scroll_view_did_end_dragging(scroll, willDecelerate: will_decelerate)
end
|
47
48
49
50
|
# File 'motion-prime/sections/collection/collection_delegate.rb', line 47
def scrollViewDidScroll(scroll)
collection_section.scroll_view_did_scroll(scroll)
collection_section.update_pull_to_refresh_after_scroll(scroll)
end
|
52
53
54
|
# File 'motion-prime/sections/collection/collection_delegate.rb', line 52
def scrollViewWillBeginDragging(scroll)
collection_section.scroll_view_will_begin_dragging(scroll)
end
|