Преглед изворни кода

1.修改RA Image照片预览,禁止缩放后图片比原图片小。
2.修改RA Image Photo List布局间隔。
3.修复RA Image上传设置不起作用。
4.增加RA Image拍照预览界面。

Pen Li пре 9 година
родитељ
комит
57618dc38e

+ 6 - 0
RA Image/RA Image.xcodeproj/project.pbxproj

@@ -13,6 +13,7 @@
 		426E6B241EB85C2B00942BE1 /* PopModeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 426E6B231EB85C2B00942BE1 /* PopModeViewController.m */; };
 		426E6B271EB85C4200942BE1 /* ModelModeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 426E6B261EB85C4200942BE1 /* ModelModeViewController.m */; };
 		426E6B291EB8720400942BE1 /* Mode.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 426E6B281EB8720400942BE1 /* Mode.storyboard */; };
+		429F25221EC9AA4200C22ABB /* TakePhotoPreviewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 429F25211EC9AA4200C22ABB /* TakePhotoPreviewController.m */; };
 		42A829C01EBC027100898B8A /* RootNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 42A829BF1EBC027100898B8A /* RootNavigationController.m */; };
 		42A829C31EBC0F8300898B8A /* ManufacturerListController.m in Sources */ = {isa = PBXBuildFile; fileRef = 42A829C21EBC0F8300898B8A /* ManufacturerListController.m */; };
 		42A829C71EBC0FAC00898B8A /* ManufacturerCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 42A829C61EBC0FAC00898B8A /* ManufacturerCell.m */; };
@@ -76,6 +77,8 @@
 		426E6B251EB85C4200942BE1 /* ModelModeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModelModeViewController.h; sourceTree = "<group>"; };
 		426E6B261EB85C4200942BE1 /* ModelModeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ModelModeViewController.m; sourceTree = "<group>"; };
 		426E6B281EB8720400942BE1 /* Mode.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Mode.storyboard; sourceTree = "<group>"; };
+		429F25201EC9AA4200C22ABB /* TakePhotoPreviewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TakePhotoPreviewController.h; sourceTree = "<group>"; };
+		429F25211EC9AA4200C22ABB /* TakePhotoPreviewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TakePhotoPreviewController.m; sourceTree = "<group>"; };
 		42A829BE1EBC027100898B8A /* RootNavigationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootNavigationController.h; sourceTree = "<group>"; };
 		42A829BF1EBC027100898B8A /* RootNavigationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RootNavigationController.m; sourceTree = "<group>"; };
 		42A829C11EBC0F8300898B8A /* ManufacturerListController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ManufacturerListController.h; sourceTree = "<group>"; };
@@ -499,6 +502,8 @@
 			children = (
 				71DCDC4F1EAF353000BA045A /* modelist.json */,
 				426E6B281EB8720400942BE1 /* Mode.storyboard */,
+				429F25201EC9AA4200C22ABB /* TakePhotoPreviewController.h */,
+				429F25211EC9AA4200C22ABB /* TakePhotoPreviewController.m */,
 				42056E851EB9CF5D0010597A /* BasicModeViewController.h */,
 				42056E861EB9CF5D0010597A /* BasicModeViewController.m */,
 				426E6B201EB85BD200942BE1 /* PopMode */,
@@ -618,6 +623,7 @@
 				71114AA61EB1C50D00D2200C /* RAUtils.m in Sources */,
 				71DCDC3C1EAF234E00BA045A /* AppDelegate.m in Sources */,
 				71961CB21EC00DDD002C4096 /* RAUploadOperation.m in Sources */,
+				429F25221EC9AA4200C22ABB /* TakePhotoPreviewController.m in Sources */,
 				42E1B1021EB1C92000EEF27C /* BasicViewController.m in Sources */,
 				426E6B1F1EB8558400942BE1 /* RootModeCell.m in Sources */,
 				71DCDC391EAF234E00BA045A /* main.m in Sources */,

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


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

@@ -2,4 +2,48 @@
 <Bucket
    type = "1"
    version = "2.0">
+   <Breakpoints>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "RA Image/AppDelegate.m"
+            timestampString = "516504853.123127"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "105"
+            endingLineNumber = "105"
+            landmarkName = "-saveUploadTasks"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "../common/upload/RAUploadManager.m"
+            timestampString = "516505979.754627"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "153"
+            endingLineNumber = "153"
+            landmarkName = "-removeTask:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            scope = "0"
+            stopOnStyle = "0">
+         </BreakpointContent>
+      </BreakpointProxy>
+   </Breakpoints>
 </Bucket>

+ 134 - 21
RA Image/RA Image/BasicModeViewController.m

@@ -12,10 +12,13 @@
 #import "UploadViewController.h"
 #import <AVFoundation/AVFoundation.h>
 #import <AssetsLibrary/AssetsLibrary.h>
+#import "TakePhotoPreviewController.h"
 
 
 @interface BasicModeViewController ()<UITextFieldDelegate>
 
+@property (nonatomic,strong) UIImagePickerController *imgPicker;
+
 @end
 
 @implementation BasicModeViewController
@@ -104,13 +107,58 @@
         return;
     }
     
+//    UIImagePickerController *imgPicker = [[UIImagePickerController alloc] init];
+//    imgPicker.delegate = self;
+//    
+//    imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
+//    imgPicker.allowsEditing = YES;
+//    [self presentViewController:imgPicker animated:YES completion:nil];
+
+    
+    // 自定义相机控制视图
     UIImagePickerController *imgPicker = [[UIImagePickerController alloc] init];
     imgPicker.delegate = self;
-    
     imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
-    imgPicker.allowsEditing = YES;
-    [self presentViewController:imgPicker animated:YES completion:nil];
+    imgPicker.allowsEditing = NO;
+    imgPicker.showsCameraControls  = NO;
+    UIView* overlay = [[UIView alloc]initWithFrame:CGRectMake(0, self.view.frame.size.height - 150 , self.view.frame.size.width, 150)];
+
+    // Cancel
+    UIButton *cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
+    cancelBtn.frame = CGRectMake(10, 10, 60, 40);
+    [cancelBtn setTitle:@"cancel" forState:UIControlStateNormal];
+    [cancelBtn addTarget:self action:@selector(cancelCameraClick:) forControlEvents:UIControlEventTouchUpInside];
+    [overlay addSubview:cancelBtn];
+    
+    // Take
+    UIButton *takeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
+    takeBtn.frame = CGRectMake(80, 10, 60, 40);
+    [takeBtn setTitle:@"take" forState:UIControlStateNormal];
+    [takeBtn addTarget:self action:@selector(takePhotoClick:) forControlEvents:UIControlEventTouchUpInside];
+    [overlay addSubview:takeBtn];
+    
+    // flash
+    UIButton *flashBtn = [UIButton buttonWithType:UIButtonTypeCustom];
+    flashBtn.frame = CGRectMake(150, 10, 60, 40);
+    [flashBtn setTitle:@"Auto" forState:UIControlStateNormal];
+    [flashBtn addTarget:self action:@selector(flashBtnClick:) forControlEvents:UIControlEventTouchUpInside];
+    [overlay addSubview:flashBtn];
+    
+    // camera
+    UIButton *cameraChangeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
+    cameraChangeBtn.frame = CGRectMake(220, 10, 60, 40);
+    [cameraChangeBtn setTitle:@"change" forState:UIControlStateNormal];
+    [cameraChangeBtn addTarget:self action:@selector(cameraChangeClick:) forControlEvents:UIControlEventTouchUpInside];
+    [overlay addSubview:cameraChangeBtn];
+    
     
+    // 相机属性设置得在设置SourceType后设置
+    imgPicker.cameraFlashMode = UIImagePickerControllerCameraFlashModeAuto;
+    //把自定义的view设置到imagepickercontroller的overlay属性中
+    imgPicker.cameraOverlayView = overlay;
+    
+    self.imgPicker = imgPicker;
+    [self presentViewController:imgPicker animated:YES completion:nil];
 }
 
 - (void)showPhotoLibrary {
@@ -247,6 +295,63 @@
     [self showCamera];
 }
 
+#pragma mark - Image Picker Button Action
+
+- (void)cancelCameraClick:(UIButton *)sender {
+    [self.imgPicker dismissViewControllerAnimated:YES completion:nil];
+}
+
+- (void)takePhotoClick:(UIButton *)sender {
+    [self.imgPicker takePicture];
+}
+
+- (void)flashBtnClick:(UIButton *)sender {
+    UIImagePickerControllerCameraDevice device = self.imgPicker.cameraDevice;
+    UIImagePickerControllerCameraFlashMode flashMode = self.imgPicker.cameraFlashMode;
+    NSString *flashMordeString = @"Auto";
+    switch (flashMode) {
+        case UIImagePickerControllerCameraFlashModeAuto: {
+            flashMode = UIImagePickerControllerCameraFlashModeOn;
+            flashMordeString = @"On";
+        }
+            break;
+        case UIImagePickerControllerCameraFlashModeOn: {
+            flashMode = UIImagePickerControllerCameraFlashModeOff;
+            flashMordeString = @"Off";
+        }
+            break;
+        case UIImagePickerControllerCameraFlashModeOff: {
+            flashMode = UIImagePickerControllerCameraFlashModeAuto;
+            flashMordeString = @"Auto";
+        }
+            break;
+            
+        default:
+            break;
+    }
+    
+    if ([UIImagePickerController isFlashAvailableForCameraDevice:device]) {
+        self.imgPicker.cameraFlashMode = flashMode;
+        [sender setTitle:flashMordeString forState:UIControlStateNormal];
+    }
+    
+}
+
+- (void)cameraChangeClick:(UIButton *)sender {
+    UIImagePickerControllerCameraDevice device = self.imgPicker.cameraDevice;
+    if (device == UIImagePickerControllerCameraDeviceRear) {
+        device = UIImagePickerControllerCameraDeviceFront;
+    } else {
+        device = UIImagePickerControllerCameraDeviceRear;
+    }
+    if ([UIImagePickerController isCameraDeviceAvailable:device]) {
+        self.imgPicker.cameraDevice = device;
+    }
+    
+}
+
+
+
 #pragma mark - Image Picker Delegate
 
 - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info
@@ -254,30 +359,38 @@
     UIImage *image = nil;
     if (picker.sourceType == UIImagePickerControllerSourceTypeCamera) {
         
-        image = [info objectForKey:UIImagePickerControllerEditedImage];
-        [picker dismissViewControllerAnimated:YES completion:nil];
+        image = [info objectForKey:UIImagePickerControllerOriginalImage];
+//        [picker dismissViewControllerAnimated:YES completion:nil];
         
     } else if (picker .sourceType == UIImagePickerControllerSourceTypePhotoLibrary) {
         
         image = [info objectForKey:UIImagePickerControllerOriginalImage];
         [picker dismissViewControllerAnimated:YES completion:nil];
     }
-    NSString *path = [self saveImage:image];
-    if (path) {// 保存成功
-        [self receiveImage:image];
-        NSString *md5 = [RAUtils md5WithFile:path];
-        NSMutableDictionary *photoDic = @{
-                                   @"photo" : image,
-                                   @"check" : @(NO),
-                                   @"file"  : [path lastPathComponent],
-                                   @"md5"   : md5,
-                                   @"path"  : path
-                                   }.mutableCopy;
-        [self.photos addObject:photoDic];
-        self.photoCount++;
-    } else {
-        [RAUtils message_alert:@"Save photo failed" title:@"Warning" controller:self];
-    }
+    __weak typeof(self) weakself = self;
+    TakePhotoPreviewController *preVC = (TakePhotoPreviewController *)[self viewControllerInStoryboard:@"Mode" withId:@"TakePhotoPreviewController"];
+    preVC.photoHandler = ^(UIImage *img){
+        if (img) {
+            NSString *path = [weakself saveImage:img];
+            if (path) {// 保存成功
+                [weakself receiveImage:img];
+                NSString *md5 = [RAUtils md5WithFile:path];
+                NSMutableDictionary *photoDic = @{
+                                                  @"photo" : img,
+                                                  @"check" : @(NO),
+                                                  @"file"  : [path lastPathComponent],
+                                                  @"md5"   : md5,
+                                                  @"path"  : path
+                                                  }.mutableCopy;
+                [weakself.photos addObject:photoDic];
+                weakself.photoCount++;
+            } else {
+                [RAUtils message_alert:@"Save photo failed" title:@"Warning" controller:weakself];
+            }
+        }
+    };
+    preVC.preImage = image;
+    [self.imgPicker pushViewController:preVC animated:YES];
 }
 
 

+ 56 - 2
RA Image/RA Image/Mode.storyboard

@@ -741,11 +741,11 @@
                                         <rect key="frame" x="0.0" y="28" width="375" height="44"/>
                                         <autoresizingMask key="autoresizingMask"/>
                                         <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Scm-6H-13W" id="WlG-lg-3va">
-                                            <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
                                             <autoresizingMask key="autoresizingMask"/>
                                             <subviews>
                                                 <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="Manufacturer" borderStyle="roundedRect" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="NYL-AQ-1Xx">
-                                                    <rect key="frame" x="0.0" y="0.0" width="414" height="43.5"/>
+                                                    <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
                                                     <nil key="textColor"/>
                                                     <fontDescription key="fontDescription" type="system" pointSize="15"/>
                                                     <textInputTraits key="textInputTraits"/>
@@ -785,6 +785,60 @@
             </objects>
             <point key="canvasLocation" x="1814" y="162"/>
         </scene>
+        <!--Take Photo Preview Controller-->
+        <scene sceneID="Y3z-vH-wec">
+            <objects>
+                <viewController storyboardIdentifier="TakePhotoPreviewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="533-wD-Chz" customClass="TakePhotoPreviewController" sceneMemberID="viewController">
+                    <layoutGuides>
+                        <viewControllerLayoutGuide type="top" id="SXM-WT-Q0L"/>
+                        <viewControllerLayoutGuide type="bottom" id="68i-cD-6Ue"/>
+                    </layoutGuides>
+                    <view key="view" contentMode="scaleToFill" id="37H-ep-vSP">
+                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="ecC-0F-hpb">
+                                <rect key="frame" x="67" y="199.5" width="240" height="268"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="268" id="D2w-f4-cYc"/>
+                                    <constraint firstAttribute="width" constant="240" id="D4j-Dz-Y8H"/>
+                                </constraints>
+                            </imageView>
+                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="aIO-Rg-abl">
+                                <rect key="frame" x="16" y="617" width="47" height="30"/>
+                                <fontDescription key="fontDescription" type="system" pointSize="15"/>
+                                <state key="normal" title="Retake"/>
+                                <connections>
+                                    <action selector="retakeBtnClick:" destination="533-wD-Chz" eventType="touchUpInside" id="DIM-kU-L5E"/>
+                                </connections>
+                            </button>
+                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Khf-Lc-MrL">
+                                <rect key="frame" x="287" y="617" width="72" height="30"/>
+                                <fontDescription key="fontDescription" type="system" pointSize="15"/>
+                                <state key="normal" title="Use Photo"/>
+                                <connections>
+                                    <action selector="usePhotoClick:" destination="533-wD-Chz" eventType="touchUpInside" id="S8B-QZ-ZyV"/>
+                                </connections>
+                            </button>
+                        </subviews>
+                        <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
+                        <constraints>
+                            <constraint firstItem="68i-cD-6Ue" firstAttribute="top" secondItem="Khf-Lc-MrL" secondAttribute="bottom" constant="20" id="2DH-lZ-PG6"/>
+                            <constraint firstItem="ecC-0F-hpb" firstAttribute="centerX" secondItem="37H-ep-vSP" secondAttribute="centerX" id="ISv-PL-6GF"/>
+                            <constraint firstItem="68i-cD-6Ue" firstAttribute="top" secondItem="aIO-Rg-abl" secondAttribute="bottom" constant="20" id="TlD-Jd-Qr8"/>
+                            <constraint firstAttribute="leadingMargin" secondItem="aIO-Rg-abl" secondAttribute="leading" id="agS-1R-OBr"/>
+                            <constraint firstAttribute="trailingMargin" secondItem="Khf-Lc-MrL" secondAttribute="trailing" id="dRr-MK-ldy"/>
+                            <constraint firstItem="ecC-0F-hpb" firstAttribute="centerY" secondItem="37H-ep-vSP" secondAttribute="centerY" id="tCv-uB-y49"/>
+                        </constraints>
+                    </view>
+                    <connections>
+                        <outlet property="previewImageView" destination="ecC-0F-hpb" id="MzG-PN-Sci"/>
+                    </connections>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="RP8-jW-gRB" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="2557.5999999999999" y="243.32833583208398"/>
+        </scene>
     </scenes>
     <resources>
         <image name="camera" width="60" height="60"/>

+ 13 - 5
RA Image/RA Image/PhotoListViewController.m

@@ -35,11 +35,6 @@
     [self.view insertSubview:v atIndex:0];
     [self removeFirstResponderTap];
     
-    UICollectionViewFlowLayout *layout = (UICollectionViewFlowLayout *)self.photoCollectionView.collectionViewLayout;
-    layout.itemSize = CGSizeMake(100,100);
-    layout.minimumLineSpacing = 10;
-    layout.minimumInteritemSpacing = 10;
-    layout.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10);
     
     self.toolBarView.layer.borderColor = [UIColor lightGrayColor].CGColor;
     self.toolBarView.layer.borderWidth = 1.0f;
@@ -53,6 +48,19 @@
     // Dispose of any resources that can be recreated.
 }
 
+- (void)viewDidLayoutSubviews {
+    [super viewDidLayoutSubviews];
+    
+    UICollectionViewFlowLayout *layout = (UICollectionViewFlowLayout *)self.photoCollectionView.collectionViewLayout;
+    CGFloat w = CGRectGetWidth(self.view.frame);
+    CGFloat h = CGRectGetHeight(self.view.frame);
+    CGFloat itemWH = (MIN(w, h) - 4 * 5) / 3;
+    layout.itemSize = CGSizeMake(itemWH,itemWH);
+    layout.minimumLineSpacing = 5;
+    layout.minimumInteritemSpacing = 5;
+    layout.sectionInset = UIEdgeInsetsMake(5, 5, 5, 5);
+}
+
 #pragma mark - Button Action
 
 - (IBAction)deleteBtnClick:(UIButton *)sender {

+ 25 - 0
RA Image/RA Image/PhotoPreviewController.m

@@ -42,6 +42,24 @@
 
 }
 
+- (CGSize)itemSize:(NSUInteger)index {
+    CGFloat width = CGRectGetWidth(self.previewScroll.bounds);
+    CGFloat height = CGRectGetHeight(self.previewScroll.bounds);
+    CGSize size = CGSizeMake(width, height);
+    
+    NSDictionary *item = [self.photos objectAtIndex:index];
+    UIImage *img = [item objectForKey:@"photo"];
+    
+    CGFloat w = img.size.width;
+    CGFloat h = img.size.height;
+    // 根据图片大小和ScrollView大小等比缩放,使ScrollView容得下图片
+    float factor = MAX(w / width, h / height);
+    factor = 1 / factor * 0.8;
+    
+    size = CGSizeMake(w * factor, h * factor);
+    return size;
+}
+
 - (void)configUI {
     
     CGFloat width = CGRectGetWidth(self.previewScroll.bounds);
@@ -117,6 +135,13 @@
     //    size.width = size.width * pinch.scale;
     //    size.height = size.height * pinch.scale;
     size = imgv.frame.size;// bounds 和 frame 不一致
+    CGSize itemSize = [self itemSize:self.currentIndex];
+    
+    if (size.height < itemSize.height || size.width < itemSize.width) { // 禁止缩小得比原图小
+        imgv.transform = CGAffineTransformIdentity;
+        size = imgv.frame.size;
+    }
+    
     
     if (size.width < width) {
         size.width = width;

+ 17 - 0
RA Image/RA Image/TakePhotoPreviewController.h

@@ -0,0 +1,17 @@
+//
+//  TakePhotoPreviewController.h
+//  RA Image
+//
+//  Created by Jack on 2017/5/15.
+//  Copyright © 2017年 USAI. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface TakePhotoPreviewController : UIViewController
+
+@property (nonatomic,strong) UIImage *preImage;
+
+@property (nonatomic,copy) void(^photoHandler) (UIImage *);
+
+@end

+ 46 - 0
RA Image/RA Image/TakePhotoPreviewController.m

@@ -0,0 +1,46 @@
+//
+//  TakePhotoPreviewController.m
+//  RA Image
+//
+//  Created by Jack on 2017/5/15.
+//  Copyright © 2017年 USAI. All rights reserved.
+//
+
+#import "TakePhotoPreviewController.h"
+
+@interface TakePhotoPreviewController ()
+
+@property (strong, nonatomic) IBOutlet UIImageView *previewImageView;
+
+@end
+
+@implementation TakePhotoPreviewController
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    // Do any additional setup after loading the view.
+    
+    self.previewImageView.image = self.preImage;
+}
+
+- (void)didReceiveMemoryWarning {
+    [super didReceiveMemoryWarning];
+    // Dispose of any resources that can be recreated.
+}
+
+- (IBAction)retakeBtnClick:(UIButton *)sender {
+    if (self.photoHandler) {
+        self.photoHandler(nil);
+    }
+    [self.navigationController popViewControllerAnimated:YES];
+}
+
+- (IBAction)usePhotoClick:(UIButton *)sender {
+    if (self.photoHandler) {
+        self.photoHandler(self.preImage);
+    }
+    [self.navigationController popViewControllerAnimated:YES];
+}
+
+
+@end

+ 3 - 1
RA Image/RA Image/UploadSettingController.m

@@ -31,7 +31,7 @@ NSString *const kUploadSetting = @"UploadSettingKey";
     
     BOOL autoUpload = YES;
     BOOL autoRmFinish = YES;
-    BOOL autoRmErr = YES;
+    BOOL autoRmErr = NO;
     int retryCount = 2;
     NSDictionary *param = [self userDefaultsValue:kUploadSetting];
     if (param) {
@@ -89,6 +89,8 @@ NSString *const kUploadSetting = @"UploadSettingKey";
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     appDelegate.uploadManager.maxRetry = retryCount;
     appDelegate.uploadManager.autoStart = autoUpload;
+    appDelegate.uploadManager.removeFinish = YES;
+    appDelegate.uploadManager.removeError = NO;
     
     [self.navigationController popViewControllerAnimated:YES];
 }