Last active
August 29, 2015 13:57
-
-
Save GantMan/9900412 to your computer and use it in GitHub Desktop.
rmq_build checking this out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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