BaseViewController.m 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //
  2. // BaseViewController.m
  3. // XenonSDK
  4. //
  5. // Created by SAGESSE on 2019/5/29.
  6. // Copyright © 2019 SAGESSE. All rights reserved.
  7. //
  8. #import "XenonSDK.h"
  9. #import "BaseViewController.h"
  10. @interface BaseViewController ()
  11. @end
  12. @implementation BaseViewController
  13. - (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
  14. return [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil ?: XenonSDK.sharedSDK.bundle];
  15. }
  16. - (void)viewDidLoad {
  17. [super viewDidLoad];
  18. // Do any additional setup after loading the view.
  19. if (!self.prefersUnifiedBackground) {
  20. return;
  21. }
  22. self.view.backgroundColor = UIColor.clearColor;
  23. }
  24. - (void)viewWillAppear:(BOOL)animated {
  25. [super viewWillAppear:animated];
  26. if (!self.prefersAutomaticBackView) {
  27. return;
  28. }
  29. if (self.navigationController.viewControllers.count == 1) {
  30. self.backView.hidden = YES;
  31. }
  32. }
  33. - (BOOL)prefersUnifiedBackground {
  34. return YES;
  35. }
  36. - (BOOL)prefersAutomaticBackView {
  37. return YES;
  38. }
  39. /*
  40. #pragma mark - Navigation
  41. // In a storyboard-based application, you will often want to do a little preparation before navigation
  42. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  43. // Get the new view controller using [segue destinationViewController].
  44. // Pass the selected object to the new view controller.
  45. }
  46. */
  47. @end