Prechádzať zdrojové kódy

1.修改iOS RA Image上传完成提示方式,以及修改拍照按钮图标。

Pen Li 8 rokov pred
rodič
commit
a0c26a65bd

BIN
RA Image/RA Image.xcodeproj/project.xcworkspace/xcuserdata/macmini1.xcuserdatad/UserInterfaceState.xcuserstate


+ 0 - 18
RA Image/RA Image.xcodeproj/xcuserdata/macmini1.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -2,22 +2,4 @@
 <Bucket
    type = "1"
    version = "2.0">
-   <Breakpoints>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "../common/upload/RANetworkTaskDelegate.m"
-            timestampString = "522915141.493607"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "81"
-            endingLineNumber = "81"
-            landmarkName = "-URLSession:task:didCompleteWithError:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-   </Breakpoints>
 </Bucket>

+ 23 - 0
RA Image/RA Image/Assets.xcassets/take_photo.imageset/Contents.json

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

BIN
RA Image/RA Image/Assets.xcassets/take_photo.imageset/take_photo.png


BIN
RA Image/RA Image/Assets.xcassets/take_photo.imageset/take_photo@2x.png


BIN
RA Image/RA Image/Assets.xcassets/take_photo.imageset/take_photo@3x.png


+ 27 - 8
RA Image/RA Image/BasicModeViewController.m

@@ -57,15 +57,19 @@
     if([keyPath isEqualToString:@"queue_status"])
     {
         NSString* msg=@"";
-
+        BOOL useToast = NO;
         switch ([[change objectForKey:NSKeyValueChangeNewKey] intValue]) {
-            case QueueStatusFinish:
+            case QueueStatusFinish: {
                 msg=@"Upload is complete.";
                 [[UIApplication sharedApplication] setIdleTimerDisabled:NO];
+                useToast = NO;
+            }
                 break;
-            case QueueStatusAdd:
+            case QueueStatusAdd: {
                 msg=@"New tasks added.";
                 [[UIApplication sharedApplication] setIdleTimerDisabled:YES];
+                useToast = YES;
+            }
                 break;
                 
             case QueueStatusFinishWithError:
@@ -78,15 +82,29 @@
                     msg=@"Some of the tasks have not been successfully uploaded.\n Check upload list for detail.";
                 
                 [[UIApplication sharedApplication] setIdleTimerDisabled:NO];
-                break;
+                useToast = NO;
+
+                
             }
+                break;
             default:
                 break;
         }
+        __weak typeof(self) weakself = self;
         dispatch_async(dispatch_get_main_queue(), ^{
             
-            if(msg.length>0)
-                [self.view makeToast:msg duration:3.0 position:CSToastPositionCenter];
+            if(msg.length>0) {
+                if (useToast) {
+                    [weakself.view makeToast:msg duration:3.0 position:CSToastPositionCenter];
+                } else {
+                    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"" message:msg preferredStyle:UIAlertControllerStyleAlert];
+                    UIAlertAction *action = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+                        
+                    }];
+                    [alert addAction:action];
+                    [weakself presentViewController:alert animated:YES completion:nil];
+                }
+            }
         });
         
     }
@@ -202,8 +220,9 @@
     
     // Take
     UIButton *takeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
-    takeBtn.frame = CGRectMake((w - 60) * 0.5, (150 - 40) * 0.5, 60, 40);
-    [takeBtn setTitle:@"take" forState:UIControlStateNormal];
+    takeBtn.frame = CGRectMake((w - 60) * 0.5, (150 - 60) * 0.5, 60, 60);
+//    [takeBtn setTitle:@"take" forState:UIControlStateNormal];
+    [takeBtn setImage:[UIImage imageNamed:@"take_photo"] forState:UIControlStateNormal];
     [takeBtn addTarget:self action:@selector(takePhotoClick:) forControlEvents:UIControlEventTouchUpInside];
     [overlay addSubview:takeBtn];