2012-03-10 93 views
2

是否有可能以某種方式停止UITabBarController旋轉但UIViewControllers(它是UITabBarController的項目)旋轉。停止UITabBarController旋轉但UIViewController旋轉

所以當設備處於縱向模式時,標籤欄將在屏幕的底部,但如果用戶旋轉設備到左側,tabbarcontroller必須保持在左側(不應以底部),但只有在的UIViewController得到旋轉?

回答

0

我會收聽UIDeviceOrientationDidChangeNotification通知, 並旋轉自己的視圖(新幀和旋轉變換)。

+0

UIInterfaceOrientation interfaceOrientation = self.interfaceOrientation; if(interfaceOrientation == UIDeviceOrientationLandscapeLeft) NSLog(@「True」); self.view.center = CGPointMake(CGRectGetWidth(self.view.bounds),0.0); //旋轉90度將其隱藏在屏幕外 CGAffineTransform rotationTransform = CGAffineTransformIdentity; rotationTransform = CGAffineTransformRotate(rotationTransform,DegreeToRadian(90)); self.view.transform = rotationTransform; } – Anand 2012-03-10 08:45:18

+0

我試過使用上面的代碼,但無法正常工作。我也考慮過旋轉視圖本身,但不確定哪種更有效的方式(動畫將更多地使用電池) – Anand 2012-03-10 08:47:25