Class: HorizontalTableContainerCell
- Inherits:
-
UITableViewCell
- Object
- UITableViewCell
- HorizontalTableContainerCell
show all
- Includes:
- ControlVariables
- Defined in:
- lib/motion-horizontal-scroll/horizontal_table_container_cell.rb
Constant Summary
ControlVariables::CELL_BACKGROUND_COLOR, ControlVariables::CELL_HEIGHT, ControlVariables::CELL_WIDTH, ControlVariables::HORIZONTAL_VIEW_SELECTED_BACKGROUND_COLOR
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#delegate ⇒ Object
Returns the value of attribute delegate.
4
5
6
|
# File 'lib/motion-horizontal-scroll/horizontal_table_container_cell.rb', line 4
def delegate
@delegate
end
|
#horizontal_table_view ⇒ Object
Returns the value of attribute horizontal_table_view.
4
5
6
|
# File 'lib/motion-horizontal-scroll/horizontal_table_container_cell.rb', line 4
def horizontal_table_view
@horizontal_table_view
end
|
#items_list ⇒ Object
Returns the value of attribute items_list.
4
5
6
|
# File 'lib/motion-horizontal-scroll/horizontal_table_container_cell.rb', line 4
def items_list
@items_list
end
|
#vertical_row_offset ⇒ Object
Returns the value of attribute vertical_row_offset.
4
5
6
|
# File 'lib/motion-horizontal-scroll/horizontal_table_container_cell.rb', line 4
def vertical_row_offset
@vertical_row_offset
end
|
Instance Method Details
#get_horizontal_table_view_frame ⇒ Object
67
68
69
|
# File 'lib/motion-horizontal-scroll/horizontal_table_container_cell.rb', line 67
def get_horizontal_table_view_frame
[get_origin_before_transformation, [CELL_HEIGHT + vertical_row_offset, Device.screen.width]]
end
|
59
60
61
|
# File 'lib/motion-horizontal-scroll/horizontal_table_container_cell.rb', line 59
def get_origin_before_transformation
[60 - vertical_row_offset, -60 + vertical_row_offset]
end
|
#get_reusable_cell(table_view) ⇒ Object
63
64
65
|
# File 'lib/motion-horizontal-scroll/horizontal_table_container_cell.rb', line 63
def get_wrapping_scroll_view_frame
[[0,0],[Device.screen.width, CELL_HEIGHT + vertical_row_offset]]
end
|
#reload_content ⇒ Object
71
72
73
|
# File 'lib/motion-horizontal-scroll/horizontal_table_container_cell.rb', line 71
def reload_content
self.horizontal_table_view.reloadData
end
|
#set_dimensions_with_row_offset ⇒ Object
26
27
28
29
30
31
32
|
# File 'lib/motion-horizontal-scroll/horizontal_table_container_cell.rb', line 26
def set_dimensions_with_row_offset
@scroll_view = setup_background_scroll_view
self.backgroundColor = UIColor.clearColor
self.horizontal_table_view = setup_horizontal_tableview
@scroll_view.addSubview(self.horizontal_table_view)
self.addSubview @scroll_view
end
|
34
35
36
37
38
39
40
41
|
# File 'lib/motion-horizontal-scroll/horizontal_table_container_cell.rb', line 34
def setup_background_scroll_view
scroll_view = UIScrollView.alloc.initWithFrame(get_wrapping_scroll_view_frame)
scroll_view.contentSize = CGSizeMake(Device.screen.width, CELL_HEIGHT + vertical_row_offset)
scroll_view.bounces = true
scroll_view.alwaysBounceHorizontal = true
scroll_view.backgroundColor = UIColor.clearColor
scroll_view
end
|
#setup_horizontal_tableview ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/motion-horizontal-scroll/horizontal_table_container_cell.rb', line 43
def setup_horizontal_tableview
horizontal_table_view = UITableView.alloc.initWithFrame(get_horizontal_table_view_frame)
horizontal_table_view.transform = CGAffineTransformMakeRotation( - (Math::PI * 0.5))
horizontal_table_view.rowHeight = CELL_WIDTH
horizontal_table_view.showsVerticalScrollIndicator = false
horizontal_table_view.showsHorizontalScrollIndicator = false
horizontal_table_view.backgroundColor = UIColor.clearColor
horizontal_table_view.separatorStyle = UITableViewCellSeparatorStyleSingleLine
horizontal_table_view.separatorColor = UIColor.clearColor
horizontal_table_view.dataSource = self
horizontal_table_view.bounces = true
horizontal_table_view.delegate = self
horizontal_table_view.alwaysBounceVertical = true
horizontal_table_view
end
|
#tableView(table_view, didSelectRowAtIndexPath: index_path) ⇒ Object
6
7
8
|
# File 'lib/motion-horizontal-scroll/horizontal_table_container_cell.rb', line 6
def tableView(table_view, numberOfRowsInSection: section)
self.items_list.count
end
|