I have a tabbar based app.
I build 2 views, one in portrait and another in landscape mode in the Interface Builder.
Now, I wanna something like the iPod App. I wanna the landscape view to be fullscreen, and hide the tabbar & the status bar.
I make to work the basic of this:
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
duration:(NSTimeInterval)duration {
if (self.landscape) {
if (toInterfaceOrientation == UIInterfaceOrientationPortrait)
{
self.view = self.portrait;
self.view.transform = CGAffineTransformMakeRotation(degreesToRadian(360));
}
else if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft)
{
self.view = self.landscape;
self.view.transform = CGAffineTransformMakeRotation(degreesToRadian(-90));
}
else if (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
self.view = self.landscape;
self.view.transform = CGAffineTransformMakeRotation(degreesToRadian(90));
}
else
{
self.view = self.portrait;
self.view.transform = CGAffineTransformMakeRotation(degreesToRadian(-180));
}
}
}
But all work messy. The landscape view not correctly fill the area and the controls are located in wrong locations, diferent as desingned first.
Also, I still not found a way to hide everything else...
Look at Apple's "AlternateViews" sample code.
The basic idea is that you can detect the physical orientation of the device with notifications, and then activate a new view controller "modally" and have it request the full screen. You disable interface rotation by having shouldAutorotate... return YES only for one orientation, since you are doing all this manually with notifications. When you change the physical orientation, your modal view controller is either presented or dismissed.
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