UINavigationController+Swizzling.m 1012 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. //
  2. // UINavigationController+Swizzling.m
  3. // NIM
  4. //
  5. // Created by chris on 15/10/26.
  6. // Copyright © 2015年 Netease. All rights reserved.
  7. //
  8. #import "UINavigationController+Swizzling.h"
  9. #import "SwizzlingDefine.h"
  10. #import "UIView+NTES.h"
  11. @implementation UINavigationController (Swizzling)
  12. + (void)load{
  13. static dispatch_once_t onceToken;
  14. dispatch_once(&onceToken, ^{
  15. swizzling_exchangeMethod([UINavigationController class] ,@selector(supportedInterfaceOrientations), @selector(swizzling_supportedInterfaceOrientations));
  16. swizzling_exchangeMethod([UINavigationController class] ,@selector(shouldAutorotate), @selector(swizzling_shouldAutorotate));
  17. });
  18. }
  19. #pragma mark - ShouldAutorotate
  20. - (BOOL)swizzling_shouldAutorotate
  21. {
  22. return [self.topViewController shouldAutorotate];
  23. }
  24. #pragma mark - SupportedInterfaceOrientations
  25. - (UIInterfaceOrientationMask)swizzling_supportedInterfaceOrientations{
  26. return [self.topViewController supportedInterfaceOrientations];
  27. }
  28. @end