diff --git a/lib/ProMotion/screen/screen_navigation.rb b/lib/ProMotion/screen/screen_navigation.rb index 533cd2c..823615b 100644 --- a/lib/ProMotion/screen/screen_navigation.rb +++ b/lib/ProMotion/screen/screen_navigation.rb @@ -14,7 +14,7 @@ module ProMotion self.split_screen.detail_screen = screen elsif args[:in_master] && self.split_screen - self.split_screen.master_screen = screen + self.split_screen.master_screen = screen elsif args[:close_all] open_root_screen screen @@ -94,7 +94,7 @@ module ProMotion # Instantiate screen if given a class screen = screen.new if screen.respond_to?(:new) - + # Set parent screen.parent_screen = self if screen.respond_to?(:parent_screen=) @@ -151,7 +151,9 @@ module ProMotion def close_nav_screen(args={}) args[:animated] = true unless args.has_key?(:animated) - if args[:to_screen] && args[:to_screen].is_a?(UIViewController) + if args[:to_screen] == :root + self.navigation_controller.popToRootViewControllerAnimated args[:animated] + elsif args[:to_screen] && args[:to_screen].is_a?(UIViewController) self.parent_screen = args[:to_screen] self.navigation_controller.popToViewController(args[:to_screen], animated: args[:animated]) else diff --git a/lib/ProMotion/table/data/table_data.rb b/lib/ProMotion/table/data/table_data.rb index 24b6bc1..63df2f7 100644 --- a/lib/ProMotion/table/data/table_data.rb +++ b/lib/ProMotion/table/data/table_data.rb @@ -73,7 +73,7 @@ module ProMotion data_cell[:cell_style] ||= UITableViewCellStyleDefault 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], 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/functional/func_screen_spec.rb b/spec/functional/func_screen_spec.rb index 9170857..593e8b9 100644 --- a/spec/functional/func_screen_spec.rb +++ b/spec/functional/func_screen_spec.rb @@ -90,4 +90,24 @@ describe "ProMotion::Screen functional" do end end + it "should pop to the root view controller" do + @root_vc = @controller.navigation_controller.visibleViewController + @controller.navigation_controller.viewControllers.count.should == 1 + @controller.open BasicScreen.new + wait 0.6 do + @controller.open BasicScreen.new + wait 0.6 do + @controller.open BasicScreen.new + wait 0.6 do + @controller.navigation_controller.viewControllers.count.should == 4 + @controller.close to_screen: :root + wait 0.6 do + @controller.navigation_controller.viewControllers.count.should == 1 + @controller.navigation_controller.topViewController.should == @root_vc + end + end + end + end + end + end diff --git a/spec/unit/tables/table_view_cell_spec.rb b/spec/unit/tables/table_view_cell_spec.rb index 2f0cca7..930c768 100644 --- a/spec/unit/tables/table_view_cell_spec.rb +++ b/spec/unit/tables/table_view_cell_spec.rb @@ -56,6 +56,7 @@ describe "PM::TableViewCellModule" do it "should have the right custom re-use identifier" do @subject.reuseIdentifier.should == "Custom 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)