Add shouldAutorotate support to tab_bar_controller

This commit is contained in:
Ryan Linton
2014-08-26 09:41:43 -07:00
committed by Jamon Holmgren
parent 17b38e4cc0
commit 24da1b7973
2 changed files with 19 additions and 2 deletions

View File

@@ -34,7 +34,21 @@ module ProMotion
end
def find_tab(tab_title)
self.viewControllers.find { |vc| vc.tabBarItem.title == tab_title }
viewControllers.find { |vc| vc.tabBarItem.title == tab_title }
end
# Cocoa touch methods below
def shouldAutorotate
selectedViewController.shouldAutorotate if selectedViewController.respond_to?(:shouldAutorotate)
end
def supportedInterfaceOrientations
selectedViewController.supportedInterfaceOrientations if selectedViewController.respond_to?(:supportedInterfaceOrientations)
end
def preferredInterfaceOrientationForPresentation
selectedViewController.preferredInterfaceOrientationForPresentation if selectedViewController.respond_to?(:preferredInterfaceOrientationForPresentation)
end
end

View File

@@ -74,6 +74,9 @@ describe "PM::Tabs" do
tab_bar.selectedIndex.should == 0
end
it "should recognize setting #should_autorotate in screen" do
@screen1.stub! :should_autorotate, return: false
@tab_bar.shouldAutorotate.should == false
end
end