Closed grimmwerks closed 8 years ago
Could you please show the code of your cell ?
Sure - I tried a couple of ways - first as your docs showed, then trying to get the redraw via the value, seeing if applying style would fix it:
https://gist.github.com/grimmwerks/3a7348784c36d49aa9229aee497b1be6
https://gist.github.com/grimmwerks/8ec8ec0f7adc5efb582983ab7da87ac5
a video showing the issue: https://www.dropbox.com/s/e1ty94asqr8caye/straps_redraw.mp4?dl=0
REALLY appreciate the assist; if it's something really stupid I'm doing.
...also very curious if you can create your own class for a section, or at least add buttons in a footer of a section. I'm sure at worst I could just use a cell for one item to add buttons to manipulate other areas but still curious.
Thanks for jumping in on slack; Mark's example was fantastic; just for others I'm pasting in what seems to work for me (which is exactly what you have in the docs; I'm unsure why it was a problem for me to begin with):
class StrapCell < PM::XLFormCell
attr_accessor :position, :tension, :name
attr_accessor :strap_name, :strap_position, :strap_tension
include StrapCellStylesheet
def initWithStyle(style, reuseIdentifier: reuse_identifier)
super.tap do
create_cell_items
end
end
def create_cell_items
@strap_image ||= append!(UIImageView, :strap_image)
@strap_name ||= append!(UILabel, :strap_name)
@strap_position ||= append!(UILabel, :strap_position)
@strap_tension ||= append!(UILabel, :strap_tension)
apply_style :strap_cell
end
def update
super
self.data_cell ||={}
# create_cell_items
@strap_name.text = value[:strap]
@strap_position.text = "Position: #{value[:position]}"
@strap_tension.text = "Tension: #{value[:tension]}"
end
end
@grimmwerks Glad to hear that.
Could I ask you to PR a section on the doc for cells when using RedPotion ?
Sure thing; I'm going to be doing a number of different custom cells / styling sections, so once I figure out a few things I definitely will!
What's the correct way of creating a custom cell? I've made one that lays out and styles properly in red potion but when it scrolls out of and returns into view the layout is all messed up.