Pārlūkot izejas kodu

1.修改RA Image照片存取。

Pen Li 9 gadi atpakaļ
vecāks
revīzija
8c426178df

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


+ 1 - 0
RA Image/RA Image/BasicModeViewController.h

@@ -23,6 +23,7 @@
 - (void)showBarcodeInput:(UIKeyboardType)keyboardType;
 - (void)clearPhotos;
 - (void)showTopImage;
+- (void)moveTmpImageToCache:(NSString *)img;
 #pragma mark - 需要子类重写
 - (void)receiveImage:(UIImage *)img;
 

+ 11 - 1
RA Image/RA Image/BasicModeViewController.m

@@ -279,7 +279,7 @@
 }
 
 - (NSString *)saveImage:(UIImage *)img {
-    NSString *dir = [NSString stringWithFormat:@"%@/%@",[RAUtils appCacheDirectory],self.name];
+    NSString *dir = [NSString stringWithFormat:@"%@/%@",NSTemporaryDirectory(),self.name];
     
     NSDate * date = [NSDate date];
     NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
@@ -357,6 +357,16 @@
     [self showCamera];
 }
 
+- (void)moveTmpImageToCache:(NSString *)img {
+    
+    NSString *dir = [NSString stringWithFormat:@"%@/%@",NSTemporaryDirectory(),self.name];
+    NSString *tmpPath = [dir stringByAppendingPathComponent:img];
+    NSString *cachePath = [NSString stringWithFormat:@"%@/%@/%@",[RAUtils appCacheDirectory],self.name,img];
+    
+    NSFileManager *fileManager = [NSFileManager defaultManager];
+    [fileManager moveItemAtPath:tmpPath toPath:cachePath error:nil];
+}
+
 #pragma mark - Image Picker Button Action
 
 - (void)cancelCameraClick:(UIButton *)sender {

+ 4 - 0
RA Image/RA Image/ModelModeViewController.m

@@ -142,6 +142,10 @@
         }
         
         task[@"params"]=params;
+        
+        NSString *file = photo[@"file"];
+        [self moveTmpImageToCache:file];
+        
         [tasks addObject:task];
         
     }

+ 4 - 0
RA Image/RA Image/PopModeViewController.m

@@ -107,6 +107,10 @@
                                  @"md5":md5
                                  };
         task[@"params"]=params;
+        
+        NSString *file = photo[@"file"];
+        [self moveTmpImageToCache:file];
+        
         [tasks addObject:task];
 
     }