SplitViewController.m 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // _____ _
  2. // |_ _| |_ _ _ ___ ___ _ __ __ _
  3. // | | | ' \| '_/ -_) -_) ' \/ _` |_
  4. // |_| |_||_|_| \___\___|_|_|_\__,_(_)
  5. //
  6. // Threema iOS Client
  7. // Copyright (c) 2015-2020 Threema GmbH
  8. //
  9. // This program is free software: you can redistribute it and/or modify
  10. // it under the terms of the GNU Affero General Public License, version 3,
  11. // as published by the Free Software Foundation.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU Affero General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Affero General Public License
  19. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. #import "SplitViewController.h"
  21. #import "MainTabBarController.h"
  22. @interface SplitViewControllerDelegate : NSObject <UISplitViewControllerDelegate>
  23. @end
  24. @interface SplitViewController ()
  25. @property MainTabBarController *tabViewController;
  26. @property SplitViewControllerDelegate *splitViewContorllerDelegate;
  27. @end
  28. @implementation SplitViewController
  29. - (void)setup {
  30. UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
  31. _tabViewController = [mainStoryboard instantiateInitialViewController];
  32. self.viewControllers = @[
  33. [[UIViewController alloc] init],
  34. _tabViewController
  35. ];
  36. }
  37. - (void)viewDidLoad {
  38. [super viewDidLoad];
  39. self.preferredDisplayMode = UISplitViewControllerDisplayModeAllVisible;
  40. }
  41. - (UIStatusBarStyle)preferredStatusBarStyle {
  42. switch ([Colors getTheme]) {
  43. case ColorThemeDark:
  44. case ColorThemeDarkWork:
  45. return UIStatusBarStyleLightContent;
  46. case ColorThemeLight:
  47. case ColorThemeLightWork:
  48. case ColorThemeUndefined:
  49. return UIStatusBarStyleDefault;
  50. default:
  51. break;
  52. }
  53. }
  54. - (BOOL)shouldAutorotate {
  55. return YES;
  56. }
  57. -(UIInterfaceOrientationMask)supportedInterfaceOrientations {
  58. if (SYSTEM_IS_IPAD) {
  59. return UIInterfaceOrientationMaskAll;
  60. }
  61. return UIInterfaceOrientationMaskAllButUpsideDown;
  62. }
  63. @end