Skip to content

Instantly share code, notes, and snippets.

@GantMan
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GantMan/9900412 to your computer and use it in GitHub Desktop.
Save GantMan/9900412 to your computer and use it in GitHub Desktop.
rmq_build checking this out
class FamilyConnectCell < UITableViewCell
def rmq_build
rmq(self.contentView).tap do |q|
# Add your subviews, init stuff here
# @foo = q.append(UILabel, :foo).get
#
# Or use the built-in table cell controls, if you don't use
# these, they won't exist at runtime
# q.build(self.imageView, :cell_image)
@switch = q.create(UISwitch, :cell_switch).on(:change) do |sender|
puts self.inspect
owner_cell = rmq(sender).closest(FamilyConnectCell).get
position = rmq(self).closest(UITableView).get.indexPathForCell(self).row
ap "Switch was flipped -> #{position}"
end.get
@name = q.build(self.textLabel, :cell_label).get
self.accessoryView = @switch
end
end
def update(data)
# Update data here
@name.text = data[:name]
@switch.on = data[:switch]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment