Class: Formotion::RowType::ButtonRow
- Defined in:
- lib/formotion/row_type/button.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#build_cell(cell) ⇒ Object
Does a clever little trick to override #layoutSubviews for just this one UITableViewCell object, in order to center it’s labels horizontally.
- #button? ⇒ Boolean
Methods inherited from Base
#_on_select, #after_build, #after_delete, #break_with_semaphore, #cellEditingStyle, #cell_style, #delete_row, #done_editing, field_buffer, #indentWhileEditing?, #initialize, #input_accessory_view, #on_delete, #on_select, #update_cell, #with_semaphore
Constructor Details
This class inherits a constructor from Formotion::RowType::Base
Instance Method Details
#build_cell(cell) ⇒ Object
Does a clever little trick to override #layoutSubviews for just this one UITableViewCell object, in order to center it’s labels horizontally.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/formotion/row_type/button.rb', line 13 def build_cell(cell) cell.selectionStyle = self.row.selection_style || UITableViewCellSelectionStyleBlue cell.swizzle(:layoutSubviews) do def layoutSubviews old_layoutSubviews center = lambda {|frame, dimen| ((self.frame.size.send(dimen) - frame.size.send(dimen)) / 2.0) } self.textLabel.center = CGPointMake(self.frame.size.width / 2, self.textLabel.center.y) self.detailTextLabel.center = CGPointMake(self.frame.size.width / 2, self.detailTextLabel.center.y) end end nil end |
#button? ⇒ Boolean
6 7 8 |
# File 'lib/formotion/row_type/button.rb', line 6 def true end |