liuzhenxing1118 1 жил өмнө
parent
commit
ee867a8b00
31 өөрчлөгдсөн 114 нэмэгдсэн , 117 устгасан
  1. 4 4
      artimenring-iOS/Artimenring/Base.lproj/Main.storyboard
  2. 6 3
      artimenring-iOS/Artimenring/Classes/Util/EUtil.mm
  3. 8 14
      artimenring-iOS/Artimenring/Classes/ViewController/Location/MainViewController+watch.m
  4. 0 22
      artimenring-iOS/Artimenring/Images.xcassets/Weather/weatcher_type_104.imageset/Contents.json
  5. 0 22
      artimenring-iOS/Artimenring/Images.xcassets/Weather/weatcher_type_105.imageset/Contents.json
  6. 0 22
      artimenring-iOS/Artimenring/Images.xcassets/Weather/weatcher_type_106.imageset/Contents.json
  7. 0 22
      artimenring-iOS/Artimenring/Images.xcassets/Weather/weatcher_type_107.imageset/Contents.json
  8. 2 2
      artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_100.imageset/Contents.json
  9. 0 0
      artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_100.imageset/weather_type_100@2x.png
  10. 0 0
      artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_100.imageset/weather_type_100@3x.png
  11. 2 2
      artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_101.imageset/Contents.json
  12. 0 0
      artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_101.imageset/weather_type_101@2x.png
  13. 0 0
      artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_101.imageset/weather_type_101@3x.png
  14. 2 2
      artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_102.imageset/Contents.json
  15. 0 0
      artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_102.imageset/weather_type_102@2x.png
  16. 0 0
      artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_102.imageset/weather_type_102@3x.png
  17. 2 2
      artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_103.imageset/Contents.json
  18. 0 0
      artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_103.imageset/weather_type_103@2x.png
  19. 0 0
      artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_103.imageset/weather_type_103@3x.png
  20. 22 0
      artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_104.imageset/Contents.json
  21. 0 0
      artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_104.imageset/weather_type_104@2x.png
  22. 0 0
      artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_104.imageset/weather_type_104@3x.png
  23. 22 0
      artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_105.imageset/Contents.json
  24. 0 0
      artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_105.imageset/weather_type_105@2x.png
  25. 0 0
      artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_105.imageset/weather_type_105@3x.png
  26. 22 0
      artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_106.imageset/Contents.json
  27. 0 0
      artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_106.imageset/weather_type_106@2x.png
  28. 0 0
      artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_106.imageset/weather_type_106@3x.png
  29. 22 0
      artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_107.imageset/Contents.json
  30. 0 0
      artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_107.imageset/weather_type_107@2x.png
  31. 0 0
      artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_107.imageset/weather_type_107@3x.png

+ 4 - 4
artimenring-iOS/Artimenring/Base.lproj/Main.storyboard

@@ -183,14 +183,14 @@
                                                         </constraints>
                                                     </imageView>
                                                     <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="weather_state_10" translatesAutoresizingMaskIntoConstraints="NO" id="RUs-hH-k8w">
-                                                        <rect key="frame" x="3" y="3" width="18" height="18"/>
+                                                        <rect key="frame" x="10" y="3" width="18" height="18"/>
                                                         <constraints>
                                                             <constraint firstAttribute="height" constant="18" id="BOc-kY-QgE"/>
                                                             <constraint firstAttribute="width" constant="18" id="fNW-Ad-KSa"/>
                                                         </constraints>
                                                     </imageView>
                                                     <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="33°" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SUr-1E-nHH">
-                                                        <rect key="frame" x="47.666666666666664" y="0.0" width="29.333333333333336" height="24"/>
+                                                        <rect key="frame" x="40.666666666666664" y="0.0" width="29.333333333333336" height="24"/>
                                                         <constraints>
                                                             <constraint firstAttribute="height" constant="24" id="dCw-7N-MRb"/>
                                                         </constraints>
@@ -212,13 +212,13 @@
                                                 </subviews>
                                                 <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
                                                 <constraints>
-                                                    <constraint firstItem="RUs-hH-k8w" firstAttribute="leading" secondItem="TwU-JV-uBA" secondAttribute="leading" constant="3" id="2y5-6x-5WK"/>
+                                                    <constraint firstItem="RUs-hH-k8w" firstAttribute="leading" secondItem="TwU-JV-uBA" secondAttribute="leading" constant="10" id="2y5-6x-5WK"/>
                                                     <constraint firstAttribute="trailing" secondItem="W8Q-dc-H9X" secondAttribute="trailing" id="3iG-UZ-qi5"/>
                                                     <constraint firstItem="W8Q-dc-H9X" firstAttribute="top" secondItem="TwU-JV-uBA" secondAttribute="top" id="4Ch-QW-VQ5"/>
                                                     <constraint firstAttribute="height" constant="44" id="9dl-Xd-V8D"/>
                                                     <constraint firstItem="RUs-hH-k8w" firstAttribute="centerY" secondItem="W8Q-dc-H9X" secondAttribute="centerY" id="PIC-kT-Zuo"/>
                                                     <constraint firstAttribute="width" constant="80" id="VN8-cA-Wta"/>
-                                                    <constraint firstAttribute="trailing" secondItem="SUr-1E-nHH" secondAttribute="trailing" constant="3" id="hUX-Cz-XKa"/>
+                                                    <constraint firstAttribute="trailing" secondItem="SUr-1E-nHH" secondAttribute="trailing" constant="10" id="hUX-Cz-XKa"/>
                                                     <constraint firstItem="W8Q-dc-H9X" firstAttribute="leading" secondItem="TwU-JV-uBA" secondAttribute="leading" id="pEu-Z5-Erg"/>
                                                     <constraint firstItem="SUr-1E-nHH" firstAttribute="centerY" secondItem="W8Q-dc-H9X" secondAttribute="centerY" id="sZp-4N-Nlz"/>
                                                 </constraints>

+ 6 - 3
artimenring-iOS/Artimenring/Classes/Util/EUtil.mm

@@ -1099,15 +1099,18 @@ void Log(const char * format, ...)
     }
 }
 
-+ (void)setUserDefaults:(NSString*)key number:(NSNumber*)number
-{
++ (void)setUserDefaults:(NSString*)key number:(NSNumber*)number {
     [[NSUserDefaults standardUserDefaults] setObject:number forKey:key];
     [[NSUserDefaults standardUserDefaults] synchronize];
 }
 
 +(NSNumber*)getUserDefaults:(NSString*)key {
     NSNumber* number = [[NSUserDefaults standardUserDefaults] objectForKey:key];
-    return number == nil ? [NSNumber numberWithInteger:0] : number;
+    if (number == nil) {
+        [self setUserDefaults:key number:[NSNumber numberWithInteger:0]];
+        return [self getUserDefaults:key];
+    }
+    return number;
 }
 
 + (id)getBundleView:(NSString*)viewName {

+ 8 - 14
artimenring-iOS/Artimenring/Classes/ViewController/Location/MainViewController+watch.m

@@ -79,17 +79,11 @@
     NSString* imageName = [NSString stringWithFormat:@"%@%ld", @"weather_type_", type];
     [self.mWeatherState setImage:[UIImage imageNamed:imageName]];
     
-    //1代表华氏,2代表摄
+    //0:代表摄氏 1代表华
     NSInteger temperature = model.now;
-    NSInteger unit = 0; //0代表华氏,1代表摄氏
     NSNumber* weatherType = [EUtil getUserDefaults:@"KEY_TYPE_WEATHER"];
-    if ([weatherType intValue] != unit) {
-        if ([weatherType intValue] == 1){
-            temperature = temperature*9/5 + 32;
-        }
-        else {
-            temperature = (temperature - 32)*5/9;
-        }
+    if ([weatherType intValue] == 1){
+        temperature = temperature*9/5 + 32;
     }
 
     if (type <= 0) {
@@ -99,8 +93,8 @@
     }
     
     UIColor* normal = [UIColor colorWithRed:0/255.0f green:1/255.0f blue:0/255.0f alpha:0.4];
-    UIColor* high = [UIColor colorWithRed:0/255.0f green:1/255.0f blue:75/255.0f alpha:1];
-    [self.mWeatherChangeDegreesC setTextColor:[weatherType intValue] == 2? high:normal];
+    UIColor* high = [UIColor colorWithRed:0/255.0f green:0/255.0f blue:0/255.0f alpha:1];
+    [self.mWeatherChangeDegreesC setTextColor:[weatherType intValue] == 0? high:normal];
     [self.mWeatherChangeDegreesF setTextColor:[weatherType intValue] == 1? high:normal];
     
     [self.mAirState setImage:[UIImage imageNamed:[NSString stringWithFormat:@"%@%ld", @"weather_aqi_", (long)_airState]]];
@@ -161,9 +155,9 @@
 
 - (IBAction)onWeatherChangeAction:(id)sender {
     NSNumber* number = [EUtil getUserDefaults:@"KEY_TYPE_WEATHER"];
-    if (!number || [number intValue] == 0) {
-        //1代表华氏,2代表摄
-        [EUtil setUserDefaults:@"KEY_TYPE_WEATHER" number:[number intValue] == 0 ? @(1):@(2)];
+    if (number) {
+        //0:代表摄氏 1代表华
+        [EUtil setUserDefaults:@"KEY_TYPE_WEATHER" number:[number intValue] == 0 ? @(1):@(0)];
     }
     [self refreshWeather];
 }

+ 0 - 22
artimenring-iOS/Artimenring/Images.xcassets/Weather/weatcher_type_104.imageset/Contents.json

@@ -1,22 +0,0 @@
-{
-  "images" : [
-    {
-      "idiom" : "universal",
-      "scale" : "1x"
-    },
-    {
-      "filename" : "weatcher_type_104@2x.png",
-      "idiom" : "universal",
-      "scale" : "2x"
-    },
-    {
-      "filename" : "weatcher_type_104@3x.png",
-      "idiom" : "universal",
-      "scale" : "3x"
-    }
-  ],
-  "info" : {
-    "author" : "xcode",
-    "version" : 1
-  }
-}

+ 0 - 22
artimenring-iOS/Artimenring/Images.xcassets/Weather/weatcher_type_105.imageset/Contents.json

@@ -1,22 +0,0 @@
-{
-  "images" : [
-    {
-      "idiom" : "universal",
-      "scale" : "1x"
-    },
-    {
-      "filename" : "weatcher_type_105@2x.png",
-      "idiom" : "universal",
-      "scale" : "2x"
-    },
-    {
-      "filename" : "weatcher_type_105@3x.png",
-      "idiom" : "universal",
-      "scale" : "3x"
-    }
-  ],
-  "info" : {
-    "author" : "xcode",
-    "version" : 1
-  }
-}

+ 0 - 22
artimenring-iOS/Artimenring/Images.xcassets/Weather/weatcher_type_106.imageset/Contents.json

@@ -1,22 +0,0 @@
-{
-  "images" : [
-    {
-      "idiom" : "universal",
-      "scale" : "1x"
-    },
-    {
-      "filename" : "weatcher_type_106@2x.png",
-      "idiom" : "universal",
-      "scale" : "2x"
-    },
-    {
-      "filename" : "weatcher_type_106@3x.png",
-      "idiom" : "universal",
-      "scale" : "3x"
-    }
-  ],
-  "info" : {
-    "author" : "xcode",
-    "version" : 1
-  }
-}

+ 0 - 22
artimenring-iOS/Artimenring/Images.xcassets/Weather/weatcher_type_107.imageset/Contents.json

@@ -1,22 +0,0 @@
-{
-  "images" : [
-    {
-      "idiom" : "universal",
-      "scale" : "1x"
-    },
-    {
-      "filename" : "weatcher_type_107@2x.png",
-      "idiom" : "universal",
-      "scale" : "2x"
-    },
-    {
-      "filename" : "weatcher_type_107@3x.png",
-      "idiom" : "universal",
-      "scale" : "3x"
-    }
-  ],
-  "info" : {
-    "author" : "xcode",
-    "version" : 1
-  }
-}

+ 2 - 2
artimenring-iOS/Artimenring/Images.xcassets/Weather/weatcher_type_100.imageset/Contents.json → artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_100.imageset/Contents.json

@@ -5,12 +5,12 @@
       "scale" : "1x"
     },
     {
-      "filename" : "weatcher_type_100@2x.png",
+      "filename" : "weather_type_100@2x.png",
       "idiom" : "universal",
       "scale" : "2x"
     },
     {
-      "filename" : "weatcher_type_100@3x.png",
+      "filename" : "weather_type_100@3x.png",
       "idiom" : "universal",
       "scale" : "3x"
     }

+ 0 - 0
artimenring-iOS/Artimenring/Images.xcassets/Weather/weatcher_type_100.imageset/weatcher_type_100@2x.png → artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_100.imageset/weather_type_100@2x.png


+ 0 - 0
artimenring-iOS/Artimenring/Images.xcassets/Weather/weatcher_type_100.imageset/weatcher_type_100@3x.png → artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_100.imageset/weather_type_100@3x.png


+ 2 - 2
artimenring-iOS/Artimenring/Images.xcassets/Weather/weatcher_type_101.imageset/Contents.json → artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_101.imageset/Contents.json

@@ -5,12 +5,12 @@
       "scale" : "1x"
     },
     {
-      "filename" : "weatcher_type_101@2x.png",
+      "filename" : "weather_type_101@2x.png",
       "idiom" : "universal",
       "scale" : "2x"
     },
     {
-      "filename" : "weatcher_type_101@3x.png",
+      "filename" : "weather_type_101@3x.png",
       "idiom" : "universal",
       "scale" : "3x"
     }

+ 0 - 0
artimenring-iOS/Artimenring/Images.xcassets/Weather/weatcher_type_101.imageset/weatcher_type_101@2x.png → artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_101.imageset/weather_type_101@2x.png


+ 0 - 0
artimenring-iOS/Artimenring/Images.xcassets/Weather/weatcher_type_101.imageset/weatcher_type_101@3x.png → artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_101.imageset/weather_type_101@3x.png


+ 2 - 2
artimenring-iOS/Artimenring/Images.xcassets/Weather/weatcher_type_102.imageset/Contents.json → artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_102.imageset/Contents.json

@@ -5,12 +5,12 @@
       "scale" : "1x"
     },
     {
-      "filename" : "weatcher_type_102@2x.png",
+      "filename" : "weather_type_102@2x.png",
       "idiom" : "universal",
       "scale" : "2x"
     },
     {
-      "filename" : "weatcher_type_102@3x.png",
+      "filename" : "weather_type_102@3x.png",
       "idiom" : "universal",
       "scale" : "3x"
     }

+ 0 - 0
artimenring-iOS/Artimenring/Images.xcassets/Weather/weatcher_type_102.imageset/weatcher_type_102@2x.png → artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_102.imageset/weather_type_102@2x.png


+ 0 - 0
artimenring-iOS/Artimenring/Images.xcassets/Weather/weatcher_type_102.imageset/weatcher_type_102@3x.png → artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_102.imageset/weather_type_102@3x.png


+ 2 - 2
artimenring-iOS/Artimenring/Images.xcassets/Weather/weatcher_type_103.imageset/Contents.json → artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_103.imageset/Contents.json

@@ -5,12 +5,12 @@
       "scale" : "1x"
     },
     {
-      "filename" : "weatcher_type_103@2x.png",
+      "filename" : "weather_type_103@2x.png",
       "idiom" : "universal",
       "scale" : "2x"
     },
     {
-      "filename" : "weatcher_type_103@3x.png",
+      "filename" : "weather_type_103@3x.png",
       "idiom" : "universal",
       "scale" : "3x"
     }

+ 0 - 0
artimenring-iOS/Artimenring/Images.xcassets/Weather/weatcher_type_103.imageset/weatcher_type_103@2x.png → artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_103.imageset/weather_type_103@2x.png


+ 0 - 0
artimenring-iOS/Artimenring/Images.xcassets/Weather/weatcher_type_103.imageset/weatcher_type_103@3x.png → artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_103.imageset/weather_type_103@3x.png


+ 22 - 0
artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_104.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "weather_type_104@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "weather_type_104@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 0 - 0
artimenring-iOS/Artimenring/Images.xcassets/Weather/weatcher_type_104.imageset/weatcher_type_104@2x.png → artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_104.imageset/weather_type_104@2x.png


+ 0 - 0
artimenring-iOS/Artimenring/Images.xcassets/Weather/weatcher_type_104.imageset/weatcher_type_104@3x.png → artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_104.imageset/weather_type_104@3x.png


+ 22 - 0
artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_105.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "weather_type_105@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "weather_type_105@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 0 - 0
artimenring-iOS/Artimenring/Images.xcassets/Weather/weatcher_type_105.imageset/weatcher_type_105@2x.png → artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_105.imageset/weather_type_105@2x.png


+ 0 - 0
artimenring-iOS/Artimenring/Images.xcassets/Weather/weatcher_type_105.imageset/weatcher_type_105@3x.png → artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_105.imageset/weather_type_105@3x.png


+ 22 - 0
artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_106.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "weather_type_106@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "weather_type_106@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 0 - 0
artimenring-iOS/Artimenring/Images.xcassets/Weather/weatcher_type_106.imageset/weatcher_type_106@2x.png → artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_106.imageset/weather_type_106@2x.png


+ 0 - 0
artimenring-iOS/Artimenring/Images.xcassets/Weather/weatcher_type_106.imageset/weatcher_type_106@3x.png → artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_106.imageset/weather_type_106@3x.png


+ 22 - 0
artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_107.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "weather_type_107@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "weather_type_107@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 0 - 0
artimenring-iOS/Artimenring/Images.xcassets/Weather/weatcher_type_107.imageset/weatcher_type_107@2x.png → artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_107.imageset/weather_type_107@2x.png


+ 0 - 0
artimenring-iOS/Artimenring/Images.xcassets/Weather/weatcher_type_107.imageset/weatcher_type_107@3x.png → artimenring-iOS/Artimenring/Images.xcassets/Weather/weather_type_107.imageset/weather_type_107@3x.png