ios - custom style for just the first row of the table view -
i trying set different style first row of table view.
i'm doing following code:
def tableview(table_view, cellforrowatindexpath: index_path) data_row = @data[index_path.row] puts index_path.row if index_path.row == 0 cell = table_view.dequeuereusablecellwithidentifier(item_cell_id) || begin rmq.create(itemcell, :first_cell, reuse_identifier: item_cell_id).get end else cell = table_view.dequeuereusablecellwithidentifier(item_cell_id) || begin rmq.create(itemcell, :rest_cell, reuse_identifier: item_cell_id).get end end cell.update(data_row) cell end
question
however weird behavior this. first row have custom styling....but 10th , 20th row!! don't know why happen. rows 2 - 9 , 11-19 different row 0 , 10 , 20.
you need use different item_cell_id
(reuseidentifiers) each cell type. :first_cell
styled cell should have different reuseidentifier
constant :rest_cell
styled cells. should fix issue since you're seeing first cell's memory being reused on , on again table scrolls.
Comments
Post a Comment