MOBaseViewController.m 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // MOBaseViewController.m
  3. // MiMoLive
  4. //
  5. // Created by SuperC on 2023/10/9.
  6. //
  7. #import "MOBaseViewController.h"
  8. @interface MOBaseViewController ()
  9. @end
  10. @implementation MOBaseViewController
  11. - (void)viewDidLoad {
  12. [super viewDidLoad];
  13. // Do any additional setup after loading the view.
  14. self.view.backgroundColor = [MOTools colorWithHexString:@"#F9F9F9" alpha:1.0];
  15. if (@available(iOS 13.0, *)) {
  16. UINavigationBarAppearance *appearance = [UINavigationBarAppearance new];
  17. [appearance configureWithOpaqueBackground];
  18. // 设置导航栏阴影图片
  19. appearance.backgroundColor = [UIColor whiteColor];
  20. appearance.shadowImage = [MOTools createImageWithColor:[UIColor clearColor]];
  21. self.navigationController.navigationBar.standardAppearance = appearance;
  22. self.navigationController.navigationBar.scrollEdgeAppearance =self.navigationController.navigationBar.standardAppearance;
  23. } else {}
  24. // 解决右滑返回失效问题
  25. self.navigationController.interactivePopGestureRecognizer.delegate = self;
  26. }
  27. - (void)viewDidAppear:(BOOL)animated {
  28. [super viewDidAppear:animated];
  29. if(self.navigationController.viewControllers.firstObject == self){
  30. // 是否允许右滑返回
  31. [self.navigationController.interactivePopGestureRecognizer setEnabled:NO];
  32. }
  33. else{
  34. // 是否允许右滑返回
  35. [self.navigationController.interactivePopGestureRecognizer setEnabled:YES];
  36. }
  37. }
  38. - (UIInterfaceOrientationMask)supportedInterfaceOrientations{
  39. return UIInterfaceOrientationMaskPortrait;
  40. }
  41. @end