Skip to content

Instantly share code, notes, and snippets.

@Gurpartap
Created March 1, 2012 16:20
Show Gist options
  • Save Gurpartap/1950972 to your computer and use it in GitHub Desktop.
Save Gurpartap/1950972 to your computer and use it in GitHub Desktop.
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
float rotation;
CGRect frame = CGRectMake(0, 0, 480, 320);
if (toInterfaceOrientation == UIInterfaceOrientationPortrait) {
rotation = 0;
frame = CGRectMake(0, 0, 320, 480);
}
else if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
rotation = M_PI/2;
}
else if (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) {
rotation = -M_PI/2;
}
camView.transform = CGAffineTransformMakeRotation(rotation);
camView.frame = frame;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment