I am developing a game in which I am using Landscape mode I have total 4 view. 2 views are properly coming in Landscape mode. But in third view I have UITable and Navigation bar. I can able to rotate table in landscape mode but not able to transform Navigation bar and Navigation controller. Navigation bar and Navigation Controller also have Button on it. It also not get transformed. So can anyone have the solution on this. :)
#define degreesToRadians(x) (M_PI * x / 180.0)
- (void)viewWillAppear:(BOOL)animated
{
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight];
CGRect newBounds = CGRectMake(0, 0, 480, 320);
self.navigationController.view.bounds = newBounds;
self.navigationController.view.center = CGPointMake(newBounds.size.height / 2.0, newBounds.size.width / 2.0);
self.navigationController.view.transform = CGAffineTransformMakeRotation(degreesToRadians(90));
[super viewWillAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
self.navigationController.view.transform = CGAffineTransformIdentity;
self.navigationController.view.transform = CGAffineTransformMakeRotation(degreesToRadians(0));
self.navigationController.view.bounds = CGRectMake(0.0, 0.0, 320.0, 480.0);
[super viewWillDisappear:animated];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With