mirror of
https://github.com/zhigang1992/ProMotion.git
synced 2026-05-28 23:50:54 +08:00
Not sure why these changes aren't in my code.
This commit is contained in:
@@ -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]
|
||||
|
||||
@@ -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])
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user