Advertisement
Guest User

Untitled

a guest
Jun 30th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. - (UIInterfaceOrientationMask)supportedInterfaceOrientations
  2. {
  3. if ([self.currentViewController isEqual:self.viewControllerYouDontWantToRotate])
  4. {
  5. return UIInterfaceOrientationMaskPortrait;
  6. }
  7. else
  8. {
  9. return UIInterfaceOrientationMaskAll;
  10. }
  11. }
  12.  
  13. - (BOOL)shouldAutorotate
  14. {
  15. if ([self.currentViewController isEqual:self.viewControllerYouDontWantToRotate])
  16. {
  17. return NO;
  18. }
  19. else
  20. {
  21. return YES;
  22. }
  23. }
  24.  
  25. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
  26. {
  27. return UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
  28. }
  29.  
  30. - (void)rotateToLandscape{
  31. NSNumber *valueLandscape = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight];
  32. [[UIDevice currentDevice] setValue:valueLandscape forKey:@"orientation"];
  33. }
  34.  
  35. - (void)rotateToPortrait{
  36. NSNumber *valuePortrait = [NSNumber numberWithInt:UIInterfaceOrientationPortrait];
  37. [[UIDevice currentDevice] setValue:valuePortrait forKey:@"orientation"];
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement