Skip to content

Instantly share code, notes, and snippets.

@Omnipresent
Created April 3, 2014 18:58
Show Gist options
  • Save Omnipresent/9960644 to your computer and use it in GitHub Desktop.
Save Omnipresent/9960644 to your computer and use it in GitHub Desktop.
class CategoryCell < 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)
@name = q.build(self.textLabel, :cell_label).get
#q.append(self.detailTextLabel, "test")
end
end
def update(data)
# Update data here
@name.text = data[:name]
@name.detailTextLabel = "test"
# @name.detail_text = "what"
end
end
@twerth
Copy link

twerth commented Apr 6, 2014

When the table needs a cell, this line will be called:
rmq.create(ItemCell, :item_cell, reuse_identifier: ITEM_CELL_ID).get

rmq will create the view and .get passes back. However, RMQ does the most common kind of create. If you need to use some other init (initWithStyle) in this case, you can created it the old fashion way. Meaning just create the view normally using ItemCell.alloc.initWithStyle

If you want to initialize an existing view in rmq, use build, not create, some pseudo code:

view = ItemCell.alloc.initWithStyle(whatever params you want)
rmq.build(view, :item_cell)

This is true with any existing view, you can either append that view, prepend it, or if you just want to bring it into the rmq world, build it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment