mirror of
https://github.com/zhigang1992/ProMotion.git
synced 2026-05-15 16:13:38 +08:00
Add shouldAutorotate support to tab_bar_controller
This commit is contained in:
committed by
Jamon Holmgren
parent
17b38e4cc0
commit
24da1b7973
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user