Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. -(void)viewWillAppear:(BOOL)animated
  2. {
  3. self.navigationController.navigationBar.translucent = false;
  4.  
  5. [self rotateController:self degrees:-90];
  6. [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft animated:NO];
  7. }
  8.  
  9. -(void)viewWillDisappear:(BOOL)animated{
  10. [super viewWillDisappear:animated];
  11. [self rotateController:self degrees:90];
  12. [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO];
  13. //set it according to 3.5 and 4.0 inch screen in protrait mode
  14. [self.view setBounds:CGRectMake(0, 0, 320, 480)];
  15. }
  16.  
  17. -(void) rotateController:(UIViewController *)controller degrees:(NSInteger)aDgrees
  18. {
  19.  
  20. controller.view.transform = CGAffineTransformConcat(controller.view.transform, CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(aDgrees)));
  21. }
  22.  
  23.  
  24. - (BOOL)shouldAutorotate
  25. {
  26. //make view landscape on start
  27. return NO;
  28. }
  29.  
  30. - (NSUInteger)supportedInterfaceOrientations
  31. {
  32. return UIInterfaceOrientationMaskLandscapeLeft;
  33. }
  34.  
  35. - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
  36. {
  37. return UIInterfaceOrientationLandscapeLeft;
  38. }
  39.  
  40. [self rotateController:self degrees:-90];
  41.  
  42. [self rotateController:self.navigationController degrees:-90];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement