ImageNameTestDelegates.m 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. /*
  2. Licensed to the Apache Software Foundation (ASF) under one
  3. or more contributor license agreements. See the NOTICE file
  4. distributed with this work for additional information
  5. regarding copyright ownership. The ASF licenses this file
  6. to you under the Apache License, Version 2.0 (the
  7. "License"); you may not use this file except in compliance
  8. with the License. You may obtain a copy of the License at
  9. http://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing,
  11. software distributed under the License is distributed on an
  12. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  13. KIND, either express or implied. See the License for the
  14. specific language governing permissions and limitations
  15. under the License.
  16. */
  17. #import <UIKit/UIKit.h>
  18. #import "ImageNameTestDelegates.h"
  19. @implementation PortraitOnly
  20. - (NSUInteger)supportedInterfaceOrientations {
  21. return UIInterfaceOrientationMaskPortrait;
  22. }
  23. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  24. return [self supportedInterfaceOrientations] & (1 << interfaceOrientation) ;
  25. }
  26. - (BOOL)shouldAutorotate {
  27. return YES;
  28. }
  29. @end
  30. @implementation PortraitUpsideDownOnly
  31. - (NSUInteger)supportedInterfaceOrientations {
  32. return UIInterfaceOrientationMaskPortraitUpsideDown;
  33. }
  34. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  35. return [self supportedInterfaceOrientations] & (1 << interfaceOrientation) ;
  36. }
  37. - (BOOL)shouldAutorotate {
  38. return YES;
  39. }
  40. @end
  41. @implementation AllPortraitOnly
  42. - (NSUInteger)supportedInterfaceOrientations {
  43. return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
  44. }
  45. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  46. return [self supportedInterfaceOrientations] & (1 << interfaceOrientation) ;
  47. }
  48. - (BOOL)shouldAutorotate {
  49. return YES;
  50. }
  51. @end
  52. @implementation LandscapeLeftOnly
  53. - (NSUInteger)supportedInterfaceOrientations {
  54. return UIInterfaceOrientationMaskLandscapeLeft;
  55. }
  56. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  57. return [self supportedInterfaceOrientations] & (1 << interfaceOrientation) ;
  58. }
  59. - (BOOL)shouldAutorotate {
  60. return YES;
  61. }
  62. @end
  63. @implementation LandscapeRightOnly
  64. - (NSUInteger)supportedInterfaceOrientations {
  65. return UIInterfaceOrientationMaskLandscapeRight;
  66. }
  67. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  68. return [self supportedInterfaceOrientations] & (1 << interfaceOrientation) ;
  69. }
  70. - (BOOL)shouldAutorotate {
  71. return YES;
  72. }
  73. @end
  74. @implementation AllLandscapeOnly
  75. - (NSUInteger)supportedInterfaceOrientations {
  76. return UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;
  77. }
  78. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  79. return [self supportedInterfaceOrientations] & (1 << interfaceOrientation) ;
  80. }
  81. - (BOOL)shouldAutorotate {
  82. return YES;
  83. }
  84. @end
  85. @implementation AllOrientations
  86. - (NSUInteger)supportedInterfaceOrientations {
  87. return UIInterfaceOrientationMaskAll;
  88. }
  89. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  90. return [self supportedInterfaceOrientations] & (1 << interfaceOrientation) ;
  91. }
  92. - (BOOL)shouldAutorotate {
  93. return YES;
  94. }
  95. @end
  96. @implementation PortraitAndLandscapeLeftOnly
  97. - (NSUInteger)supportedInterfaceOrientations {
  98. return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft;
  99. }
  100. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  101. return [self supportedInterfaceOrientations] & (1 << interfaceOrientation) ;
  102. }
  103. - (BOOL)shouldAutorotate {
  104. return YES;
  105. }
  106. @end
  107. @implementation PortraitAndLandscapeRightOnly
  108. - (NSUInteger)supportedInterfaceOrientations {
  109. return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeRight;
  110. }
  111. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  112. return [self supportedInterfaceOrientations] & (1 << interfaceOrientation) ;
  113. }
  114. - (BOOL)shouldAutorotate {
  115. return YES;
  116. }
  117. @end
  118. @implementation PortraitUpsideDownAndLandscapeLeftOnly
  119. - (NSUInteger)supportedInterfaceOrientations {
  120. return UIInterfaceOrientationMaskPortraitUpsideDown | UIInterfaceOrientationMaskLandscapeLeft;
  121. }
  122. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  123. return [self supportedInterfaceOrientations] & (1 << interfaceOrientation) ;
  124. }
  125. - (BOOL)shouldAutorotate {
  126. return YES;
  127. }
  128. @end
  129. @implementation PortraitUpsideDownAndLandscapeRightOnly
  130. - (NSUInteger)supportedInterfaceOrientations {
  131. return UIInterfaceOrientationMaskPortraitUpsideDown | UIInterfaceOrientationMaskLandscapeRight;
  132. }
  133. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  134. return [self supportedInterfaceOrientations] & (1 << interfaceOrientation) ;
  135. }
  136. - (BOOL)shouldAutorotate {
  137. return YES;
  138. }
  139. @end