diff --git a/lib/ProMotion/table/data/table_data.rb b/lib/ProMotion/table/data/table_data.rb index 6bf4136..63df2f7 100644 --- a/lib/ProMotion/table/data/table_data.rb +++ b/lib/ProMotion/table/data/table_data.rb @@ -71,9 +71,9 @@ module ProMotion def set_data_cell_defaults(data_cell) data_cell[:cell_style] ||= UITableViewCellStyleDefault - data_cell[:cell_identifier] ||= build_cell_identifier(data_cell) data_cell[:cell_class] ||= PM::TableViewCell - + data_cell[:cell_identifier] ||= build_cell_identifier(data_cell) + data_cell[:accessory] = { view: data_cell[:accessory], value: data_cell[:accessory_value], @@ -85,9 +85,9 @@ module ProMotion end def build_cell_identifier(data_cell) - ident = "#{data_cell[:cell_class]}" + ident = "#{data_cell[:cell_class].to_s}" ident << "-#{data_cell[:stylename].to_s}" if data_cell[:stylename] # For Teacup - ident << "-#{data_cell[:accessory][:view].to_s}" if data_cell[:accessory] + ident << "-accessory" if data_cell[:accessory] ident << "-subtitle" if data_cell[:subtitle] ident << "-remoteimage" if data_cell[:remote_image] ident << "-image" if data_cell[:image] diff --git a/lib/ProMotion/table/table.rb b/lib/ProMotion/table/table.rb index f281fe5..77e075b 100644 --- a/lib/ProMotion/table/table.rb +++ b/lib/ProMotion/table/table.rb @@ -104,10 +104,10 @@ module ProMotion table_cell end - + def create_table_cell(data_cell) table_cell = table_view.dequeueReusableCellWithIdentifier(data_cell[:cell_identifier]) - + unless table_cell data_cell[:cell_style] ||= UITableViewCellStyleSubtitle table_cell = data_cell[:cell_class].alloc.initWithStyle(data_cell[:cell_style], reuseIdentifier:data_cell[:cell_identifier]) diff --git a/spec/unit/tables/table_view_cell_spec.rb b/spec/unit/tables/table_view_cell_spec.rb index 86031ec..28a5b27 100644 --- a/spec/unit/tables/table_view_cell_spec.rb +++ b/spec/unit/tables/table_view_cell_spec.rb @@ -56,10 +56,11 @@ describe "PM::TableViewCellModule" do it "should have the right custom re-use identifier" do @subject.reuseIdentifier.should == "Cell" end + it "should have the right generated re-use identifier" do ip = NSIndexPath.indexPathForRow(2, inSection: 1) subject = @screen.tableView(@screen.table_view, cellForRowAtIndexPath: ip) - subject.reuseIdentifier.should == "Cell-accessory" + subject.reuseIdentifier.should == "ProMotion::TableViewCell-accessory" end it "should have the correct height" do