NCNavigationController.m 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
  3. * SPDX-License-Identifier: GPL-3.0-or-later
  4. */
  5. #import "NCNavigationController.h"
  6. #import "NCAppBranding.h"
  7. @interface NCNavigationController () <UIGestureRecognizerDelegate>
  8. @end
  9. @implementation NCNavigationController
  10. - (void)viewDidLoad
  11. {
  12. [super viewDidLoad];
  13. self.interactivePopGestureRecognizer.delegate = self;
  14. [self.navigationBar setTitleTextAttributes:
  15. @{NSForegroundColorAttributeName:[NCAppBranding themeTextColor]}];
  16. self.navigationBar.tintColor = [NCAppBranding themeTextColor];
  17. self.navigationBar.barTintColor = [NCAppBranding themeColor];
  18. self.navigationBar.translucent = NO;
  19. UINavigationBarAppearance *appearance = [[UINavigationBarAppearance alloc] init];
  20. [appearance configureWithOpaqueBackground];
  21. appearance.backgroundColor = [NCAppBranding themeColor];
  22. appearance.titleTextAttributes = @{NSForegroundColorAttributeName:[NCAppBranding themeTextColor]};
  23. self.navigationItem.standardAppearance = appearance;
  24. self.navigationItem.compactAppearance = appearance;
  25. self.navigationItem.scrollEdgeAppearance = appearance;
  26. }
  27. - (UIStatusBarStyle)preferredStatusBarStyle
  28. {
  29. return [NCAppBranding statusBarStyleForThemeColor];
  30. }
  31. - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
  32. {
  33. // This allows to overwrite the pop gesture recognizer with another gesture recognizer
  34. // (e.g. long press gesture to record voice message when interface is in RTL)
  35. return YES;
  36. }
  37. @end