Class: OrganizzeForm::Form
- Inherits:
-
Object
- Object
- OrganizzeForm::Form
- Defined in:
- lib/organizze-form/form.rb
Instance Attribute Summary collapse
-
#sections ⇒ Object
readonly
Returns the value of attribute sections.
-
#uuid ⇒ Object
readonly
Returns the value of attribute uuid.
Instance Method Summary collapse
- #cellFor(tableView, indexPath) ⇒ Object
-
#initialize ⇒ Form
constructor
A new instance of Form.
- #section(&block) ⇒ Object
Constructor Details
#initialize ⇒ Form
Returns a new instance of Form.
5 6 7 8 |
# File 'lib/organizze-form/form.rb', line 5 def initialize @sections = [] @uuid = NSUUID.alloc.init.UUIDString end |
Instance Attribute Details
#sections ⇒ Object (readonly)
Returns the value of attribute sections.
3 4 5 |
# File 'lib/organizze-form/form.rb', line 3 def sections @sections end |
#uuid ⇒ Object (readonly)
Returns the value of attribute uuid.
3 4 5 |
# File 'lib/organizze-form/form.rb', line 3 def uuid @uuid end |
Instance Method Details
#cellFor(tableView, indexPath) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/organizze-form/form.rb', line 16 def cellFor(tableView, indexPath) @tableView ||= WeakRef.new(tableView) section = @sections[indexPath.section] row = section.rows[indexPath.row] cell_id = "form-cell-#{@uuid}-#{indexPath.section}-#{indexPath.row}".freeze (tableView.dequeueReusableCellWithIdentifier(cell_id) || UITableViewCell.alloc.initWithStyle(UITableViewCellStyleDefault, reuseIdentifier: cell_id)).tap do |cell| row.setup_cell(cell) end end |