Class: Loco::TableView
- Inherits:
-
UITableView
- Object
- UITableView
- Loco::TableView
show all
- Includes:
- Observable, Resizable
- Defined in:
- lib/motion-loco/table_view.rb
Instance Attribute Summary
Attributes included from Resizable
#bottom, #height, #left, #parent_view, #right, #top, #width
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Observable
included, #init, #initWithStyle, #initialize, #method_missing, #register_observer, #remove_all_observers, #remove_observer, #set_properties
Methods included from Resizable
#refresh_layout, #viewSetup, #view_setup, #willMoveToSuperview
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Loco::Observable
Class Method Details
.get_item_view_class ⇒ Object
103
104
105
|
# File 'lib/motion-loco/table_view.rb', line 103
def get_item_view_class
@item_view_class ||= TableViewCell
end
|
.item_view_class(view_class) ⇒ Object
Also known as:
itemViewClass
98
99
100
|
# File 'lib/motion-loco/table_view.rb', line 98
def item_view_class(view_class)
@item_view_class = view_class
end
|
Instance Method Details
#cell_id ⇒ Object
56
57
58
|
# File 'lib/motion-loco/table_view.rb', line 56
def cell_id
@cell_id ||= "CELL_#{self.object_id}"
end
|
#content=(value) ⇒ Object
51
52
53
54
|
# File 'lib/motion-loco/table_view.rb', line 51
def content=(value)
super
self.reloadData
end
|
#initWithFrame(frame) ⇒ Object
60
61
62
63
|
# File 'lib/motion-loco/table_view.rb', line 60
def initWithFrame(frame)
super(frame)
self.dataSource = self.delegate = self
end
|
#item_view_class ⇒ Object
65
66
67
|
# File 'lib/motion-loco/table_view.rb', line 65
def item_view_class
self.class.send(:get_item_view_class)
end
|
#tableView(tableView, numberOfRowsInSection: section) ⇒ Integer
UITableViewDelegate implementation for returning the number of rows in a section.
71
72
73
74
75
76
77
78
|
# File 'lib/motion-loco/table_view.rb', line 71
def tableView(tableView, cellForRowAtIndexPath:indexPath)
cell = tableView.dequeueReusableCellWithIdentifier(cell_id)
unless cell
cell = self.item_view_class.alloc.initWithStyle(UITableViewCellStyleDefault, reuseIdentifier:cell_id)
end
cell.content = self.content[indexPath.row]
cell
end
|