I have a view that switches to landscape mode using the following code:
Code:
UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation;
if (deviceOrientation == UIDeviceOrientationLandscapeLeft) {
[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];
self.view.transform = CGAffineTransformIdentity;
self.view.transform = CGAffineTransformMakeRotation((M_PI * (90) / 180.0));
self.view.bounds = CGRectMake(10.0, 0.0, 480, 320);
} else if (deviceOrientation == UIDeviceOrientationLandscapeRight) {
[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];
self.view.transform = CGAffineTransformIdentity;
self.view.transform = CGAffineTransformMakeRotation((M_PI * (-90) / 180.0));
self.view.bounds = CGRectMake(-10.0, 0.0, 480, 320);
} else if (deviceOrientation == UIDeviceOrientationPortrait) {
[[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO];
self.view.transform = CGAffineTransformIdentity;
self.view.transform = CGAffineTransformMakeRotation((M_PI * (0) / 180.0));
self.view.bounds = CGRectMake(0.0, 0.0, 320, 416);
}
When I switch it to landscape, it all rotates fine. However, when the user tries to copy and paste, that is still sideways for some reason as in the bubble that appears to select text is sideways. Why might this be?
Also, when I rotate it back, the iPhone places a 20px white line on top and bottom for some reason...