2012-03-10 94 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