Marino Faggiana 7 жил өмнө
parent
commit
8215bba9d6

+ 1 - 0
iOSClient/AppDelegate.h

@@ -148,6 +148,7 @@
 - (void)aspectNavigationControllerBar:(UINavigationBar *)nav encrypted:(BOOL)encrypted online:(BOOL)online hidden:(BOOL)hidden;
 - (void)aspectTabBar:(UITabBar *)tab hidden:(BOOL)hidden;
 - (void)plusButtonVisibile:(BOOL)visible;
+- (void)selectedTabBarController:(NSInteger)index;
 
 - (void)settingThemingColorBrand;
 - (void)changeTheming:(UIViewController *)vc;

+ 25 - 0
iOSClient/AppDelegate.m

@@ -956,6 +956,31 @@
     }
 }
 
+- (void)selectedTabBarController:(NSInteger)index
+{
+    UISplitViewController *splitViewController = (UISplitViewController *)self.window.rootViewController;
+    
+    if (splitViewController.isCollapsed) {
+        
+        UITabBarController *tbc = splitViewController.viewControllers.firstObject;
+        for (UINavigationController *nvc in tbc.viewControllers) {
+            
+            if ([nvc.topViewController isKindOfClass:[CCDetail class]])
+                [nvc popToRootViewControllerAnimated:NO];
+        }
+        
+        [tbc setSelectedIndex: index];
+        
+    } else {
+        
+        UINavigationController *nvcDetail = splitViewController.viewControllers.lastObject;
+        [nvcDetail popToRootViewControllerAnimated:NO];
+        
+        UITabBarController *tbc = splitViewController.viewControllers.firstObject;
+        [tbc setSelectedIndex: index];
+    }
+}
+
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark ===== Theming Color =====
 #pragma --------------------------------------------------------------------------------------------