浏览代码

New offline interface

Marino Faggiana 8 年之前
父节点
当前提交
a0f1654a57
共有 3 个文件被更改,包括 41 次插入4 次删除
  1. 6 0
      iOSClient/AppDelegate.m
  2. 1 1
      iOSClient/Main/Main.storyboard
  3. 34 3
      iOSClient/Offline/CCOffline.m

+ 6 - 0
iOSClient/AppDelegate.m

@@ -164,6 +164,12 @@
     // ico Image Cache
     self.icoImagesCache = [[NSMutableDictionary alloc] init];
     
+    //
+    UIPageControl *pageControl = [UIPageControl appearance];
+    pageControl.pageIndicatorTintColor = COLOR_SEPARATOR_TABLE;
+    pageControl.currentPageIndicatorTintColor = COLOR_NEXTCLOUD;
+    pageControl.backgroundColor = [UIColor clearColor];
+    
     // remove tmp & cache
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
     

+ 1 - 1
iOSClient/Main/Main.storyboard

@@ -602,7 +602,6 @@
         <!--Offline Page Content-->
         <scene sceneID="gxD-z5-PYJ">
             <objects>
-                <placeholder placeholderIdentifier="IBFirstResponder" id="hcx-8L-qXq" userLabel="First Responder" sceneMemberID="firstResponder"/>
                 <tableViewController storyboardIdentifier="OfflinePageContentViewController" extendedLayoutIncludesOpaqueBars="YES" id="9Lm-gl-WZM" customClass="CCOfflinePageContent" sceneMemberID="viewController">
                     <tableView key="view" opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" allowsSelectionDuringEditing="YES" rowHeight="60" sectionHeaderHeight="22" sectionFooterHeight="22" id="vzb-Ug-0wK">
                         <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
@@ -620,6 +619,7 @@
                         <segue destination="mtc-lf-PRo" kind="showDetail" id="UBW-f3-oFA"/>
                     </connections>
                 </tableViewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="hcx-8L-qXq" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
             <point key="canvasLocation" x="7119" y="1218"/>
         </scene>

+ 34 - 3
iOSClient/Offline/CCOffline.m

@@ -30,7 +30,7 @@
 
 @interface CCOffline ()
 {
-
+    UIPageControl *pageControl;
 }
 
 @end
@@ -58,9 +58,8 @@
     NSArray *viewControllers = @[startingViewController];
     [self.pageViewController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];
 
-
     // Change the size of page view controller
-    self.pageViewController.view.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height - 30);
+    self.pageViewController.view.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
     
     [self addChildViewController:_pageViewController];
     [self.view addSubview:_pageViewController.view];
@@ -137,6 +136,7 @@
     return 0;
 }
 
+/*
 - (void)pageViewController:(UIPageViewController *)pageViewController willTransitionToViewControllers:(NSArray<UIViewController *> *)pendingViewControllers
 {
     CCOfflinePageContent *vc = (CCOfflinePageContent *)pendingViewControllers[0];
@@ -157,5 +157,36 @@
             self.title = @"Local";
     }
 }
+*/
+
+- (void)pageViewController:(UIPageViewController *)pageViewController didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray<UIViewController *> *)previousViewControllers transitionCompleted:(BOOL)completed
+{
+    CCOfflinePageContent *vc = [self.pageViewController.viewControllers lastObject];
+    
+    NSString *serverUrl = vc.localServerUrl;
+    NSString *pageType = vc.pageType;
+
+    if ([pageType isEqualToString:@"Offline"]) {
+        if (serverUrl)
+            self.title = @"Offline";
+        else
+            self.title = @"Offline";
+        
+        UITabBarItem *item = [self.tabBarController.tabBar.items objectAtIndex:TabBarApplicationIndexOffline];
+        item.selectedImage = [UIImage imageNamed:@"tabBarOffline"];
+        item.image = [UIImage imageNamed:@"tabBarOffline"];
+    }
+    
+    if ([pageType isEqualToString:@"Local"]) {
+        if ([serverUrl isEqualToString:[CCUtility getDirectoryLocal]])
+            self.title = @"Local";
+        else
+            self.title = @"Local";
+        
+        UITabBarItem *item = [self.tabBarController.tabBar.items objectAtIndex:TabBarApplicationIndexOffline];
+        item.selectedImage = [UIImage imageNamed:@"tabBarLocal"];
+        item.image = [UIImage imageNamed:@"tabBarLocal"];
+    }
+}
 
 @end