CGXVerticalMenuCustomBaseView.m 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //
  2. // CGXVerticalMenuCustomBaseView.m
  3. // CGXVerticalMenuView-OC
  4. //
  5. // Created by CGX on 2018/05/01.
  6. // Copyright © 2019 CGX. All rights reserved.
  7. //
  8. #import "CGXVerticalMenuCustomBaseView.h"
  9. @implementation CGXVerticalMenuCustomBaseView
  10. - (void)willMoveToSuperview:(UIView *)newSuperview {
  11. [super willMoveToSuperview:newSuperview];
  12. UIResponder *next = newSuperview;
  13. while (next != nil) {
  14. if ([next isKindOfClass:[UIViewController class]]) {
  15. UIViewController *vc = (UIViewController *)next;
  16. if (@available(iOS 11.0, *)) {
  17. vc.automaticallyAdjustsScrollViewInsets = NO;
  18. }
  19. break;
  20. }
  21. next = next.nextResponder;
  22. }
  23. }
  24. - (instancetype)initWithFrame:(CGRect)frame
  25. {
  26. self = [super initWithFrame:frame];
  27. if (self) {
  28. [self initializeData];
  29. [self initializeViews];
  30. }
  31. return self;
  32. }
  33. - (instancetype)initWithCoder:(NSCoder *)coder
  34. {
  35. self = [super initWithCoder:coder];
  36. if (self) {
  37. [self initializeData];
  38. [self initializeViews];
  39. }
  40. return self;
  41. }
  42. - (void)initializeData
  43. {
  44. }
  45. - (void)initializeViews
  46. {
  47. }
  48. /*
  49. // Only override drawRect: if you perform custom drawing.
  50. // An empty implementation adversely affects performance during animation.
  51. - (void)drawRect:(CGRect)rect {
  52. // Drawing code
  53. }
  54. */
  55. @end