Răsfoiți Sursa

1.完成Photo列表查看以及Photo预览。

Pen Li 9 ani în urmă
părinte
comite
18d422b8dd

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

@@ -13,6 +13,11 @@
 		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 */; };
+		42BC2CFF1EBAC4050016B30D /* PhotoListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BC2CFE1EBAC4050016B30D /* PhotoListViewController.m */; };
+		42BC2D011EBAC4310016B30D /* PhotoList.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 42BC2D001EBAC4310016B30D /* PhotoList.storyboard */; };
+		42BC2D051EBAC4C00016B30D /* PhotoCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BC2D041EBAC4C00016B30D /* PhotoCell.m */; };
+		42BC2D091EBAC75F0016B30D /* TouchImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BC2D081EBAC75F0016B30D /* TouchImageView.m */; };
+		42BC2D0C1EBB00FD0016B30D /* PhotoPreviewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BC2D0B1EBB00FD0016B30D /* PhotoPreviewController.m */; };
 		42E1B0FD1EB1C8EE00EEF27C /* LoginSwitchCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 42E1B0FB1EB1C8EE00EEF27C /* LoginSwitchCell.m */; };
 		42E1B0FE1EB1C8EE00EEF27C /* LoginTextFiledCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 42E1B0FC1EB1C8EE00EEF27C /* LoginTextFiledCell.m */; };
 		42E1B1021EB1C92000EEF27C /* BasicViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 42E1B1011EB1C92000EEF27C /* BasicViewController.m */; };
@@ -61,6 +66,15 @@
 		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>"; };
+		42BC2CFD1EBAC4050016B30D /* PhotoListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhotoListViewController.h; sourceTree = "<group>"; };
+		42BC2CFE1EBAC4050016B30D /* PhotoListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PhotoListViewController.m; sourceTree = "<group>"; };
+		42BC2D001EBAC4310016B30D /* PhotoList.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = PhotoList.storyboard; sourceTree = "<group>"; };
+		42BC2D031EBAC4C00016B30D /* PhotoCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhotoCell.h; sourceTree = "<group>"; };
+		42BC2D041EBAC4C00016B30D /* PhotoCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PhotoCell.m; sourceTree = "<group>"; };
+		42BC2D071EBAC75F0016B30D /* TouchImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TouchImageView.h; sourceTree = "<group>"; };
+		42BC2D081EBAC75F0016B30D /* TouchImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TouchImageView.m; sourceTree = "<group>"; };
+		42BC2D0A1EBB00FD0016B30D /* PhotoPreviewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhotoPreviewController.h; sourceTree = "<group>"; };
+		42BC2D0B1EBB00FD0016B30D /* PhotoPreviewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PhotoPreviewController.m; sourceTree = "<group>"; };
 		42E1B0F91EB1C8EE00EEF27C /* LoginSwitchCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoginSwitchCell.h; sourceTree = "<group>"; };
 		42E1B0FA1EB1C8EE00EEF27C /* LoginTextFiledCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoginTextFiledCell.h; sourceTree = "<group>"; };
 		42E1B0FB1EB1C8EE00EEF27C /* LoginSwitchCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LoginSwitchCell.m; sourceTree = "<group>"; };
@@ -175,6 +189,37 @@
 			name = ModelMode;
 			sourceTree = "<group>";
 		};
+		42BC2CFC1EBAC3D40016B30D /* PhotoList */ = {
+			isa = PBXGroup;
+			children = (
+				42BC2D001EBAC4310016B30D /* PhotoList.storyboard */,
+				42BC2CFD1EBAC4050016B30D /* PhotoListViewController.h */,
+				42BC2CFE1EBAC4050016B30D /* PhotoListViewController.m */,
+				42BC2D0A1EBB00FD0016B30D /* PhotoPreviewController.h */,
+				42BC2D0B1EBB00FD0016B30D /* PhotoPreviewController.m */,
+				42BC2D021EBAC4950016B30D /* view */,
+			);
+			name = PhotoList;
+			sourceTree = "<group>";
+		};
+		42BC2D021EBAC4950016B30D /* view */ = {
+			isa = PBXGroup;
+			children = (
+				42BC2D031EBAC4C00016B30D /* PhotoCell.h */,
+				42BC2D041EBAC4C00016B30D /* PhotoCell.m */,
+			);
+			name = view;
+			sourceTree = "<group>";
+		};
+		42BC2D061EBAC74A0016B30D /* Common */ = {
+			isa = PBXGroup;
+			children = (
+				42BC2D071EBAC75F0016B30D /* TouchImageView.h */,
+				42BC2D081EBAC75F0016B30D /* TouchImageView.m */,
+			);
+			name = Common;
+			sourceTree = "<group>";
+		};
 		42E1B0F71EB1C8BB00EEF27C /* Login */ = {
 			isa = PBXGroup;
 			children = (
@@ -334,8 +379,10 @@
 			children = (
 				71114AB71EB1C68B00D2200C /* const.h */,
 				71114AB81EB1C6B700D2200C /* config.h */,
+				42BC2D061EBAC74A0016B30D /* Common */,
 				71114AA71EB1C51200D2200C /* util */,
 				42E1B10D1EB1E91D00EEF27C /* Network */,
+				42BC2CFC1EBAC3D40016B30D /* PhotoList */,
 				71DCDC4E1EAF34F800BA045A /* modes */,
 				71114AE21EB2DEE800D2200C /* cam scan */,
 				42E1B0F71EB1C8BB00EEF27C /* Login */,
@@ -438,6 +485,7 @@
 				71114AEE1EB2DEF900D2200C /* cam_scan.storyboard in Resources */,
 				71DCDC421EAF234E00BA045A /* Main.storyboard in Resources */,
 				71114AB31EB1C5C800D2200C /* LICENSE in Resources */,
+				42BC2D011EBAC4310016B30D /* PhotoList.storyboard in Resources */,
 				42E1B1041EB1CCB200EEF27C /* login.json in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
@@ -449,7 +497,9 @@
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				42BC2D051EBAC4C00016B30D /* PhotoCell.m in Sources */,
 				71114AB21EB1C5C800D2200C /* AESCrypt.m in Sources */,
+				42BC2D0C1EBB00FD0016B30D /* PhotoPreviewController.m in Sources */,
 				426E6B241EB85C2B00942BE1 /* PopModeViewController.m in Sources */,
 				71114AF01EB2DEF900D2200C /* RAMenu.m in Sources */,
 				71114AC61EB1C73B00D2200C /* ioapi.c in Sources */,
@@ -468,12 +518,14 @@
 				71114AC91EB1C73B00D2200C /* zip.c in Sources */,
 				71114AF31EB2DEF900D2200C /* SCShapeView.m in Sources */,
 				71114AF21EB2DEF900D2200C /* ScannerViewController.m in Sources */,
+				42BC2D091EBAC75F0016B30D /* TouchImageView.m in Sources */,
 				71114AB61EB1C5C800D2200C /* NSString+Base64.m in Sources */,
 				71114AA61EB1C50D00D2200C /* RAUtils.m in Sources */,
 				71DCDC3C1EAF234E00BA045A /* AppDelegate.m in Sources */,
 				42E1B1021EB1C92000EEF27C /* BasicViewController.m in Sources */,
 				426E6B1F1EB8558400942BE1 /* RootModeCell.m in Sources */,
 				71DCDC391EAF234E00BA045A /* main.m in Sources */,
+				42BC2CFF1EBAC4050016B30D /* PhotoListViewController.m in Sources */,
 				71114ABC1EB1C73400D2200C /* ZipArchive.mm in Sources */,
 				42056E871EB9CF5D0010597A /* BasicModeViewController.m in Sources */,
 				42E1B0FE1EB1C8EE00EEF27C /* LoginTextFiledCell.m in Sources */,

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


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

@@ -10,14 +10,18 @@
 
 @interface BasicModeViewController : BasicViewController<UINavigationControllerDelegate,UIImagePickerControllerDelegate>
 
+@property (nonatomic,copy) NSString *name;
 @property (nonatomic,copy) NSString *barcode;
+@property (nonatomic,copy) NSString *barcodeTitle;
+@property (nonatomic,assign) NSUInteger photoCount;
+@property (nonatomic,strong) NSArray *photos;
 
+- (void)showPhotoList;
 - (void)showScanner;
 - (void)clickCameraButton;
 - (void)showBarcodeInput;
 
 #pragma mark - 需要子类重写
 - (void)receiveImage:(UIImage *)img;
-- (void)receiveBarcode:(NSString *)code;
 
 @end

+ 50 - 2
RA Image/RA Image/BasicModeViewController.m

@@ -8,6 +8,7 @@
 
 #import "BasicModeViewController.h"
 #import "ScannerViewController.h"
+#import "PhotoListViewController.h"
 
 @interface BasicModeViewController ()<UITextFieldDelegate>
 
@@ -25,6 +26,17 @@
     // Dispose of any resources that can be recreated.
 }
 
+- (void)viewWillAppear:(BOOL)animated {
+    [super viewWillAppear:animated];
+    [self loadSavedPhotoCount];
+}
+
+- (void)showPhotoList {
+    PhotoListViewController *photoListVC = (PhotoListViewController *)[self viewControllerInStoryboard:@"PhotoList" withId:@"PhotoListViewController"];
+    photoListVC.photos = [self.photos mutableCopy];
+    [self.navigationController pushViewController:photoListVC animated:YES];
+}
+
 - (void)showScanner {
     __weak typeof(self) weakself = self;
     ScannerViewController *scannerVC = [[UIStoryboard storyboardWithName:@"cam_scan" bundle:nil] instantiateViewControllerWithIdentifier:@"NewScannerViewController"];
@@ -35,7 +47,7 @@
             if (weakself) {
                 __strong typeof(weakself) strongself = weakself;
                 
-                [strongself receiveBarcode:code];
+                strongself.barcode = code;
             }
             
         }
@@ -100,8 +112,43 @@
     
 }
 
-- (void)receiveBarcode:(NSString *)code {
+- (void)saveImage:(UIImage *)img {
+    NSString *dir = [NSString stringWithFormat:@"%@/%@",[RAUtils appCacheDirectory],self.name];
+    
+    NSDate * date = [NSDate date];
+    NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
+    [dateFormatter setDateFormat:@"YYYY-MM-dd HH:mm:ss"];
+    NSString * name = [[dateFormatter stringFromDate:date] stringByAppendingPathExtension:@"png"];
+
+    NSString *path = [dir stringByAppendingPathComponent:name];
     
+    [RAUtils saveData:UIImagePNGRepresentation(img) toPath:path];
+}
+
+- (void)loadSavedPhotoCount {
+    NSString *dir = [NSString stringWithFormat:@"%@/%@",[RAUtils appCacheDirectory],self.name];
+    NSFileManager *manager = [NSFileManager defaultManager];
+    NSArray *files = [manager contentsOfDirectoryAtPath:dir error:nil];
+    if (files.count) {
+        NSMutableArray *photos = [NSMutableArray array];
+        for (NSString *name in files) {
+            if ([name hasSuffix:@".png"]) {
+                NSString *path = [dir stringByAppendingPathComponent:name];
+                UIImage *img = [UIImage imageWithContentsOfFile:path];
+                NSDictionary *photoDic = @{
+                                           @"photo" : img,
+                                           @"check" : @(NO),
+                                           @"path"  : path
+                                           };
+                [photos addObject:photoDic];
+            }
+        }
+        self.photoCount = photos.count;
+        self.photos = photos;
+    } else {
+        self.photoCount = 0;
+        self.photos = nil;
+    }
 }
 
 #pragma mark - Public Method
@@ -145,6 +192,7 @@
         image = [info objectForKey:UIImagePickerControllerOriginalImage];
         [picker dismissViewControllerAnimated:YES completion:nil];
     }
+    [self saveImage:image];
     [self receiveImage:image];
     
 }

+ 41 - 15
RA Image/RA Image/Mode.storyboard

@@ -133,15 +133,26 @@
                                     <action selector="typeBtnClick:" destination="K9i-vs-efO" eventType="touchUpInside" id="NoL-VF-6k9"/>
                                 </connections>
                             </button>
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="5 Photos" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="m3e-vD-xep">
+                                <rect key="frame" x="50" y="57" width="300" height="20"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="20" id="mgg-Dx-4kA"/>
+                                </constraints>
+                                <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                                <color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
+                                <nil key="highlightedColor"/>
+                            </label>
                         </subviews>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                         <constraints>
+                            <constraint firstItem="m3e-vD-xep" firstAttribute="width" secondItem="tx6-Jq-V78" secondAttribute="width" id="4MC-Nn-YNk"/>
                             <constraint firstItem="7rM-i2-eHr" firstAttribute="bottom" secondItem="tx6-Jq-V78" secondAttribute="bottom" constant="50" id="5oU-RN-aAR"/>
                             <constraint firstItem="tx6-Jq-V78" firstAttribute="top" secondItem="dcO-dt-BeO" secondAttribute="bottom" constant="30" id="5rw-rk-Rgm"/>
                             <constraint firstAttribute="trailingMargin" secondItem="7rM-i2-eHr" secondAttribute="trailing" id="AnY-BM-aep"/>
                             <constraint firstItem="NAz-nK-Hgz" firstAttribute="top" secondItem="6jr-Xw-2tL" secondAttribute="top" id="Azo-Ej-bva"/>
                             <constraint firstItem="jte-R6-noU" firstAttribute="height" secondItem="NAz-nK-Hgz" secondAttribute="height" id="Cz1-jn-gUG"/>
                             <constraint firstItem="NAz-nK-Hgz" firstAttribute="bottom" secondItem="6jr-Xw-2tL" secondAttribute="bottom" id="DbX-Yw-N8R"/>
+                            <constraint firstItem="m3e-vD-xep" firstAttribute="leading" secondItem="tx6-Jq-V78" secondAttribute="leading" id="DeE-hi-LR6"/>
                             <constraint firstItem="NAz-nK-Hgz" firstAttribute="centerX" secondItem="7rM-i2-eHr" secondAttribute="centerX" id="E5d-E1-Uxn"/>
                             <constraint firstItem="jte-R6-noU" firstAttribute="trailing" secondItem="7rM-i2-eHr" secondAttribute="trailing" id="F9a-4T-n2t"/>
                             <constraint firstItem="jte-R6-noU" firstAttribute="width" secondItem="NAz-nK-Hgz" secondAttribute="width" id="G9A-SK-NbZ"/>
@@ -152,6 +163,7 @@
                             <constraint firstItem="7rM-i2-eHr" firstAttribute="leading" secondItem="tx6-Jq-V78" secondAttribute="leading" id="IkZ-kb-uSH"/>
                             <constraint firstItem="7rM-i2-eHr" firstAttribute="width" secondItem="tx6-Jq-V78" secondAttribute="width" id="KLA-9l-yX3"/>
                             <constraint firstItem="Rvg-OG-bQ0" firstAttribute="centerY" secondItem="7rM-i2-eHr" secondAttribute="centerY" id="LEW-U8-sy4"/>
+                            <constraint firstItem="m3e-vD-xep" firstAttribute="top" secondItem="tx6-Jq-V78" secondAttribute="top" id="LmC-C6-vLP"/>
                             <constraint firstItem="6jr-Xw-2tL" firstAttribute="width" secondItem="NAz-nK-Hgz" secondAttribute="width" id="OGr-rO-amZ"/>
                             <constraint firstItem="NAz-nK-Hgz" firstAttribute="centerX" secondItem="7rM-i2-eHr" secondAttribute="centerX" id="PH0-8k-I6I"/>
                             <constraint firstItem="tx6-Jq-V78" firstAttribute="centerY" secondItem="QEg-TT-jt8" secondAttribute="centerY" id="PVr-4c-8If"/>
@@ -206,6 +218,7 @@
                                 <exclude reference="rZO-Cu-PjR"/>
                                 <exclude reference="sxc-Kf-lRS"/>
                                 <exclude reference="wjm-RD-ue6"/>
+                                <exclude reference="UFG-NX-fXs"/>
                                 <exclude reference="ITb-vM-nLr"/>
                                 <exclude reference="OGr-rO-amZ"/>
                                 <exclude reference="PaT-5f-5BR"/>
@@ -236,7 +249,6 @@
                                 <exclude reference="mIV-7G-bzr"/>
                                 <exclude reference="oYB-P2-H5S"/>
                                 <exclude reference="xNj-Z3-CKd"/>
-                                <exclude reference="UFG-NX-fXs"/>
                             </mask>
                         </variation>
                         <variation key="heightClass=compact-widthClass=compact">
@@ -285,6 +297,7 @@
                                 <include reference="5oU-RN-aAR"/>
                                 <include reference="IkZ-kb-uSH"/>
                                 <include reference="KLA-9l-yX3"/>
+                                <include reference="UFG-NX-fXs"/>
                                 <include reference="dXd-PM-PHl"/>
                                 <include reference="Azo-Ej-bva"/>
                                 <include reference="fWf-CG-Oxq"/>
@@ -295,7 +308,6 @@
                                 <include reference="aEa-b6-mFx"/>
                                 <include reference="fPr-5K-jIw"/>
                                 <include reference="xNj-Z3-CKd"/>
-                                <include reference="UFG-NX-fXs"/>
                             </mask>
                         </variation>
                     </view>
@@ -303,6 +315,7 @@
                         <outlet property="barcodeLabel" destination="7rM-i2-eHr" id="aB2-mx-aAt"/>
                         <outlet property="camerBtn" destination="NAz-nK-Hgz" id="5L3-aN-Dtb"/>
                         <outlet property="imgBtn" destination="tx6-Jq-V78" id="xle-Dc-8GI"/>
+                        <outlet property="photoCountLabel" destination="m3e-vD-xep" id="wXJ-p8-s26"/>
                         <outlet property="scanBtn" destination="6jr-Xw-2tL" id="ciK-Vz-r3k"/>
                         <outlet property="typeBtn" destination="Rvg-OG-bQ0" id="EZg-8i-wR7"/>
                         <outlet property="uploadBtn" destination="jte-R6-noU" id="aQd-uP-dmR"/>
@@ -337,32 +350,32 @@
                                 </constraints>
                                 <variation key="default">
                                     <mask key="constraints">
-                                        <exclude reference="jyS-DL-baZ"/>
-                                        <exclude reference="mCl-LY-zev"/>
+                                        <exclude reference="P4F-3c-O90"/>
+                                        <exclude reference="RlC-zy-TdJ"/>
                                         <exclude reference="UMs-Q1-i7w"/>
                                         <exclude reference="XIa-j5-AGR"/>
-                                        <exclude reference="RlC-zy-TdJ"/>
-                                        <exclude reference="P4F-3c-O90"/>
+                                        <exclude reference="jyS-DL-baZ"/>
+                                        <exclude reference="mCl-LY-zev"/>
                                     </mask>
                                 </variation>
                                 <variation key="heightClass=compact-widthClass=compact">
                                     <mask key="constraints">
-                                        <include reference="mCl-LY-zev"/>
                                         <include reference="P4F-3c-O90"/>
+                                        <include reference="mCl-LY-zev"/>
                                     </mask>
                                 </variation>
                                 <variation key="heightClass=compact-widthClass=regular">
                                     <mask key="constraints">
-                                        <include reference="UMs-Q1-i7w"/>
                                         <include reference="RlC-zy-TdJ"/>
+                                        <include reference="UMs-Q1-i7w"/>
                                     </mask>
                                 </variation>
                                 <variation key="heightClass=regular-widthClass=compact">
                                     <mask key="constraints">
+                                        <exclude reference="P4F-3c-O90"/>
+                                        <include reference="XIa-j5-AGR"/>
                                         <include reference="jyS-DL-baZ"/>
                                         <exclude reference="mCl-LY-zev"/>
-                                        <include reference="XIa-j5-AGR"/>
-                                        <exclude reference="P4F-3c-O90"/>
                                     </mask>
                                 </variation>
                                 <connections>
@@ -426,7 +439,7 @@
                                 </connections>
                             </button>
                             <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" keyboardDismissMode="interactive" text="Note:" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="ZS1-pc-kXu">
-                                <rect key="frame" x="370" y="130" width="346" height="184"/>
+                                <rect key="frame" x="370" y="130.66666666666663" width="346" height="183.33333333333337"/>
                                 <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                 <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
@@ -453,6 +466,15 @@
                                     <action selector="typeBtnClick:" destination="7Iz-ry-1hB" eventType="touchUpInside" id="7gC-wE-byx"/>
                                 </connections>
                             </button>
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="5 Photos" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JAw-ik-fYD">
+                                <rect key="frame" x="50" y="84" width="300" height="20"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="20" id="gr4-N2-NFP"/>
+                                </constraints>
+                                <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                                <color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
+                                <nil key="highlightedColor"/>
+                            </label>
                         </subviews>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                         <constraints>
@@ -470,6 +492,7 @@
                             <constraint firstItem="gY5-Tk-ev9" firstAttribute="leading" secondItem="i3W-S0-nip" secondAttribute="leading" id="7x0-YS-4WJ"/>
                             <constraint firstItem="RZK-hh-toU" firstAttribute="top" secondItem="i3W-S0-nip" secondAttribute="top" id="B3m-FM-7Wx"/>
                             <constraint firstItem="i3W-S0-nip" firstAttribute="top" secondItem="gY5-Tk-ev9" secondAttribute="bottom" constant="8" id="Bdg-Gf-Ion"/>
+                            <constraint firstItem="JAw-ik-fYD" firstAttribute="top" secondItem="i3W-S0-nip" secondAttribute="top" id="CAS-t5-5eZ"/>
                             <constraint firstItem="i3W-S0-nip" firstAttribute="centerX" secondItem="o96-bU-q7q" secondAttribute="centerX" id="Cyd-MP-wCx"/>
                             <constraint firstItem="8cw-MJ-Ahc" firstAttribute="leading" secondItem="RZK-hh-toU" secondAttribute="leading" id="DDb-NZ-fPw"/>
                             <constraint firstItem="xAA-t1-vMd" firstAttribute="height" secondItem="951-qi-5kI" secondAttribute="height" id="Fdp-ve-rXy"/>
@@ -499,6 +522,7 @@
                             <constraint firstItem="gY5-Tk-ev9" firstAttribute="width" secondItem="i3W-S0-nip" secondAttribute="width" id="b1h-sL-21M"/>
                             <constraint firstItem="ZS1-pc-kXu" firstAttribute="top" secondItem="RZK-hh-toU" secondAttribute="bottom" constant="19.5" id="b5u-Xv-NO9"/>
                             <constraint firstItem="xAA-t1-vMd" firstAttribute="trailing" secondItem="ZS1-pc-kXu" secondAttribute="trailing" id="bLt-dG-GN6"/>
+                            <constraint firstItem="JAw-ik-fYD" firstAttribute="width" secondItem="i3W-S0-nip" secondAttribute="width" id="bkE-Ii-uyD"/>
                             <constraint firstItem="gY5-Tk-ev9" firstAttribute="leading" secondItem="i3W-S0-nip" secondAttribute="leading" id="cAf-h5-l3V"/>
                             <constraint firstItem="xAA-t1-vMd" firstAttribute="height" secondItem="951-qi-5kI" secondAttribute="height" id="dN1-g3-Mda"/>
                             <constraint firstItem="i3W-S0-nip" firstAttribute="top" secondItem="4Aa-BZ-4nb" secondAttribute="bottom" constant="50" id="dZe-Lr-jbB"/>
@@ -526,6 +550,7 @@
                             <constraint firstItem="RZK-hh-toU" firstAttribute="leading" secondItem="i3W-S0-nip" secondAttribute="trailing" constant="30" id="tjD-kp-s3D"/>
                             <constraint firstItem="951-qi-5kI" firstAttribute="top" secondItem="ZS1-pc-kXu" secondAttribute="bottom" constant="10" id="ukF-93-xfZ"/>
                             <constraint firstItem="8cw-MJ-Ahc" firstAttribute="bottom" secondItem="i3W-S0-nip" secondAttribute="bottom" id="vZx-LD-eJX"/>
+                            <constraint firstItem="JAw-ik-fYD" firstAttribute="leading" secondItem="i3W-S0-nip" secondAttribute="leading" id="va5-0V-pUF"/>
                             <constraint firstItem="951-qi-5kI" firstAttribute="baseline" secondItem="8cw-MJ-Ahc" secondAttribute="firstBaseline" id="vkf-vf-2IX"/>
                             <constraint firstItem="i3W-S0-nip" firstAttribute="leading" secondItem="o96-bU-q7q" secondAttribute="leadingMargin" constant="30" id="w45-Qc-74D"/>
                             <constraint firstItem="951-qi-5kI" firstAttribute="firstBaseline" secondItem="8cw-MJ-Ahc" secondAttribute="baseline" id="waZ-2w-RW1"/>
@@ -570,6 +595,8 @@
                                 <exclude reference="gUk-GU-v1u"/>
                                 <exclude reference="hbN-Zu-Pll"/>
                                 <exclude reference="sMx-RK-bdo"/>
+                                <exclude reference="5QC-IL-i1w"/>
+                                <exclude reference="rgN-nI-NeD"/>
                                 <exclude reference="6Uu-lh-pOC"/>
                                 <exclude reference="DDb-NZ-fPw"/>
                                 <exclude reference="PFl-di-byG"/>
@@ -603,8 +630,6 @@
                                 <exclude reference="mG3-eu-q03"/>
                                 <exclude reference="obK-KN-Wre"/>
                                 <exclude reference="xbY-aK-MNO"/>
-                                <exclude reference="5QC-IL-i1w"/>
-                                <exclude reference="rgN-nI-NeD"/>
                             </mask>
                         </variation>
                         <variation key="heightClass=compact-widthClass=compact">
@@ -647,6 +672,7 @@
                                 <include reference="02G-Zl-PJ1"/>
                                 <include reference="3Zf-6r-xDu"/>
                                 <include reference="Q7L-Cg-Rml"/>
+                                <include reference="5QC-IL-i1w"/>
                                 <include reference="PFl-di-byG"/>
                                 <include reference="PKZ-co-q6C"/>
                                 <include reference="RPz-TG-EgB"/>
@@ -658,7 +684,6 @@
                                 <include reference="Fdp-ve-rXy"/>
                                 <include reference="Med-B3-2rc"/>
                                 <include reference="obK-KN-Wre"/>
-                                <include reference="5QC-IL-i1w"/>
                             </mask>
                         </variation>
                         <variation key="heightClass=regular-widthClass=compact">
@@ -676,6 +701,7 @@
                                 <include reference="VVS-oN-KzO"/>
                                 <include reference="gUk-GU-v1u"/>
                                 <include reference="sMx-RK-bdo"/>
+                                <include reference="rgN-nI-NeD"/>
                                 <include reference="DDb-NZ-fPw"/>
                                 <include reference="7GX-rm-Lu7"/>
                                 <include reference="XMG-Nj-hPo"/>
@@ -687,7 +713,6 @@
                                 <include reference="Hru-49-ooh"/>
                                 <include reference="mG3-eu-q03"/>
                                 <include reference="xbY-aK-MNO"/>
-                                <include reference="rgN-nI-NeD"/>
                             </mask>
                         </variation>
                     </view>
@@ -697,6 +722,7 @@
                         <outlet property="imgBtn" destination="i3W-S0-nip" id="DWN-sP-yzj"/>
                         <outlet property="manufactureBtn" destination="gY5-Tk-ev9" id="dAy-tZ-keQ"/>
                         <outlet property="noteTextView" destination="ZS1-pc-kXu" id="bDX-sx-1Ba"/>
+                        <outlet property="photoCountLabel" destination="JAw-ik-fYD" id="Kuy-id-nMd"/>
                         <outlet property="scanBtn" destination="8cw-MJ-Ahc" id="Zhe-1n-APc"/>
                         <outlet property="typeBtn" destination="A3O-9b-0D7" id="h1j-9y-M8X"/>
                         <outlet property="uploadBtn" destination="xAA-t1-vMd" id="ofR-9N-Bz4"/>

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

@@ -21,6 +21,7 @@
 @property (strong, nonatomic) IBOutlet UIButton *cameraBtn;
 @property (strong, nonatomic) IBOutlet UIButton *uploadBtn;
 @property (strong, nonatomic) IBOutlet UIButton *typeBtn;
+@property (strong, nonatomic) IBOutlet UILabel *photoCountLabel;
 
 
 
@@ -46,7 +47,7 @@
 #pragma mark - Button Action
 
 - (IBAction)imgBtnClick:(UIButton *)sender {
-    self.barcodeLabel.text = @"img";
+    [self showPhotoList];
 }
 
 - (IBAction)manufactureBtnClick:(UIButton *)sender {
@@ -65,6 +66,7 @@
     self.barcodeLabel.text = @"upl";
 }
 - (IBAction)typeBtnClick:(UIButton *)sender {
+    [self showBarcodeInput];
 }
 
 #pragma mark - Super Method
@@ -75,10 +77,20 @@
     }
 }
 
-- (void)receiveBarcode:(NSString *)code {
-    if (code.length) {
-        self.barcodeLabel.text = [NSString stringWithFormat:@"Model:%@",code];
+- (void)setBarcode:(NSString *)barcode {
+    [super setBarcode:barcode];
+    self.barcodeLabel.text = [NSString stringWithFormat:@"%@:%@",self.barcodeTitle,barcode];
+}
+
+- (void)setPhotoCount:(NSUInteger)photoCount {
+    [super setPhotoCount:photoCount];
+    NSString *str = nil;
+    if (photoCount > 0) {
+        str = [NSString stringWithFormat:@"%lu Photos",photoCount];
+    } else {
+        str = @"No Photos";
     }
+    self.photoCountLabel.text = str;
 }
 
 #pragma mark - TextView Delegate

+ 28 - 0
RA Image/RA Image/PhotoCell.h

@@ -0,0 +1,28 @@
+//
+//  PhotoCell.h
+//  RA Image
+//
+//  Created by Jack on 2017/5/4.
+//  Copyright © 2017年 USAI. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "TouchImageView.h"
+
+@class PhotoCell;
+
+@protocol PhotoCellDelegate <NSObject>
+
+- (void)checkPhotoCell:(PhotoCell *)cell;
+
+@end
+
+@interface PhotoCell : UICollectionViewCell
+
+@property (nonatomic,strong) UIImage *photo;
+@property (nonatomic,weak) id <PhotoCellDelegate> delegate;
+
+@property (strong, nonatomic) IBOutlet UIImageView *photoImageView;
+@property (strong, nonatomic) IBOutlet UIButton *checkBtn;
+
+@end

+ 34 - 0
RA Image/RA Image/PhotoCell.m

@@ -0,0 +1,34 @@
+//
+//  PhotoCell.m
+//  RA Image
+//
+//  Created by Jack on 2017/5/4.
+//  Copyright © 2017年 USAI. All rights reserved.
+//
+
+#import "PhotoCell.h"
+
+@interface PhotoCell ()
+
+@end
+
+@implementation PhotoCell
+
+
+- (void)setPhoto:(UIImage *)photo {
+    _photo = photo;
+    self.photoImageView.image = photo;
+}
+
+#pragma mark - Button Action
+
+- (IBAction)checkBtnClick:(UIButton *)sender {
+    if (self.delegate && [self.delegate respondsToSelector:@selector(checkPhotoCell:)]) {
+        [self.delegate checkPhotoCell:self];
+    }
+}
+
+
+
+
+@end

+ 191 - 0
RA Image/RA Image/PhotoList.storyboard

@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16A323" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina5_5" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <scenes>
+        <!--Photo List View Controller-->
+        <scene sceneID="s6R-Gr-NZf">
+            <objects>
+                <viewController storyboardIdentifier="PhotoListViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="xdl-ms-hcE" customClass="PhotoListViewController" sceneMemberID="viewController">
+                    <layoutGuides>
+                        <viewControllerLayoutGuide type="top" id="eK3-GP-EYq"/>
+                        <viewControllerLayoutGuide type="bottom" id="BJJ-hy-xax"/>
+                    </layoutGuides>
+                    <view key="view" contentMode="scaleToFill" id="Byo-fh-hkx">
+                        <rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="uOk-hT-zrx">
+                                <rect key="frame" x="0.0" y="20" width="414" height="676"/>
+                                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                <collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="9t5-lc-Ukh">
+                                    <size key="itemSize" width="100" height="100"/>
+                                    <size key="headerReferenceSize" width="0.0" height="0.0"/>
+                                    <size key="footerReferenceSize" width="0.0" height="0.0"/>
+                                    <inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
+                                </collectionViewFlowLayout>
+                                <cells>
+                                    <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="PhotoCell" id="rIk-OD-0lk" customClass="PhotoCell">
+                                        <rect key="frame" x="0.0" y="0.0" width="100" height="100"/>
+                                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                                        <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
+                                            <rect key="frame" x="0.0" y="0.0" width="100" height="100"/>
+                                            <autoresizingMask key="autoresizingMask"/>
+                                            <subviews>
+                                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="UmZ-qq-ZJo">
+                                                    <rect key="frame" x="1" y="1" width="98" height="98"/>
+                                                </imageView>
+                                                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="7Hz-d3-VbJ">
+                                                    <rect key="frame" x="70" y="0.0" width="30" height="30"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="height" constant="30" id="fcD-nH-U5R"/>
+                                                        <constraint firstAttribute="width" constant="30" id="oon-Ke-ar6"/>
+                                                    </constraints>
+                                                    <state key="normal" title="😯"/>
+                                                    <state key="selected" title="🌹"/>
+                                                    <connections>
+                                                        <action selector="checkBtnClick:" destination="rIk-OD-0lk" eventType="touchUpInside" id="tSw-f8-93A"/>
+                                                    </connections>
+                                                </button>
+                                            </subviews>
+                                        </view>
+                                        <constraints>
+                                            <constraint firstItem="7Hz-d3-VbJ" firstAttribute="top" secondItem="rIk-OD-0lk" secondAttribute="top" id="7x0-FH-pZ9"/>
+                                            <constraint firstAttribute="trailing" secondItem="7Hz-d3-VbJ" secondAttribute="trailing" id="DOj-GD-wmD"/>
+                                            <constraint firstAttribute="bottom" secondItem="UmZ-qq-ZJo" secondAttribute="bottom" constant="1" id="GVa-FF-jTh"/>
+                                            <constraint firstItem="UmZ-qq-ZJo" firstAttribute="top" secondItem="rIk-OD-0lk" secondAttribute="top" constant="1" id="KFq-2N-rrZ"/>
+                                            <constraint firstAttribute="trailing" secondItem="UmZ-qq-ZJo" secondAttribute="trailing" constant="1" id="hCs-CK-oZu"/>
+                                            <constraint firstItem="UmZ-qq-ZJo" firstAttribute="leading" secondItem="rIk-OD-0lk" secondAttribute="leading" constant="1" id="ks0-xT-4yC"/>
+                                        </constraints>
+                                        <connections>
+                                            <outlet property="checkBtn" destination="7Hz-d3-VbJ" id="bnZ-Ay-fvO"/>
+                                            <outlet property="photoImageView" destination="UmZ-qq-ZJo" id="nuW-cc-CGC"/>
+                                        </connections>
+                                    </collectionViewCell>
+                                </cells>
+                                <connections>
+                                    <outlet property="dataSource" destination="xdl-ms-hcE" id="CuU-s7-4mV"/>
+                                    <outlet property="delegate" destination="xdl-ms-hcE" id="aJ4-YJ-arH"/>
+                                </connections>
+                            </collectionView>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="96x-9C-cOu">
+                                <rect key="frame" x="-2" y="696" width="418" height="42"/>
+                                <subviews>
+                                    <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="GWc-40-6TW">
+                                        <rect key="frame" x="15" y="6" width="60" height="30"/>
+                                        <constraints>
+                                            <constraint firstAttribute="width" constant="60" id="I6g-AA-Oct"/>
+                                            <constraint firstAttribute="height" constant="30" id="mcY-XV-rWK"/>
+                                        </constraints>
+                                        <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                                        <state key="normal" title="Delete">
+                                            <color key="titleColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
+                                        </state>
+                                        <connections>
+                                            <action selector="deleteBtnClick:" destination="xdl-ms-hcE" eventType="touchUpInside" id="jMi-hS-ZbZ"/>
+                                        </connections>
+                                    </button>
+                                    <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="j1h-rd-hX7">
+                                        <rect key="frame" x="95" y="6" width="60" height="30"/>
+                                        <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                                        <state key="normal" title="Upload">
+                                            <color key="titleColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
+                                        </state>
+                                        <connections>
+                                            <action selector="uploadBtnClick:" destination="xdl-ms-hcE" eventType="touchUpInside" id="xhY-iv-sTa"/>
+                                        </connections>
+                                    </button>
+                                </subviews>
+                                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                <constraints>
+                                    <constraint firstAttribute="bottom" secondItem="GWc-40-6TW" secondAttribute="bottom" constant="6" id="AiL-zm-b2V"/>
+                                    <constraint firstItem="j1h-rd-hX7" firstAttribute="width" secondItem="GWc-40-6TW" secondAttribute="width" id="Bch-lO-lq0"/>
+                                    <constraint firstItem="GWc-40-6TW" firstAttribute="leading" secondItem="96x-9C-cOu" secondAttribute="leading" constant="15" id="MvH-24-FVo"/>
+                                    <constraint firstItem="GWc-40-6TW" firstAttribute="top" secondItem="96x-9C-cOu" secondAttribute="top" constant="6" id="N8y-ZD-FiM"/>
+                                    <constraint firstItem="j1h-rd-hX7" firstAttribute="top" secondItem="GWc-40-6TW" secondAttribute="top" id="coR-2H-oid"/>
+                                    <constraint firstItem="j1h-rd-hX7" firstAttribute="height" secondItem="GWc-40-6TW" secondAttribute="height" id="lx1-Yi-D9l"/>
+                                    <constraint firstItem="j1h-rd-hX7" firstAttribute="leading" secondItem="GWc-40-6TW" secondAttribute="trailing" constant="20" id="qSO-S0-Adn"/>
+                                </constraints>
+                            </view>
+                        </subviews>
+                        <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                        <constraints>
+                            <constraint firstItem="96x-9C-cOu" firstAttribute="leading" secondItem="Byo-fh-hkx" secondAttribute="leading" constant="-2" id="Gbo-1F-bl9"/>
+                            <constraint firstItem="96x-9C-cOu" firstAttribute="top" secondItem="uOk-hT-zrx" secondAttribute="bottom" id="Mjj-wa-wpq"/>
+                            <constraint firstItem="BJJ-hy-xax" firstAttribute="top" secondItem="uOk-hT-zrx" secondAttribute="bottom" constant="40" id="POH-av-OVo"/>
+                            <constraint firstItem="uOk-hT-zrx" firstAttribute="leading" secondItem="Byo-fh-hkx" secondAttribute="leading" id="R4x-2b-nZc"/>
+                            <constraint firstItem="uOk-hT-zrx" firstAttribute="top" secondItem="eK3-GP-EYq" secondAttribute="bottom" id="TzV-hv-D85"/>
+                            <constraint firstAttribute="bottom" secondItem="96x-9C-cOu" secondAttribute="bottom" constant="-2" id="kne-Nz-mZM"/>
+                            <constraint firstAttribute="trailing" secondItem="96x-9C-cOu" secondAttribute="trailing" constant="-2" id="mws-WN-HY3"/>
+                            <constraint firstAttribute="trailing" secondItem="uOk-hT-zrx" secondAttribute="trailing" id="nfz-6z-Rem"/>
+                        </constraints>
+                    </view>
+                    <connections>
+                        <outlet property="deleteBtn" destination="GWc-40-6TW" id="Tyj-b5-sU4"/>
+                        <outlet property="photoCollectionView" destination="uOk-hT-zrx" id="rBu-gr-wyy"/>
+                        <outlet property="toolBarView" destination="96x-9C-cOu" id="D4u-3L-0ur"/>
+                        <outlet property="uploadBtn" destination="j1h-rd-hX7" id="nnq-sq-t9o"/>
+                    </connections>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="D3Y-1i-0Ln" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="75.362318840579718" y="75.815217391304358"/>
+        </scene>
+        <!--Photo Preview Controller-->
+        <scene sceneID="bAZ-bO-5GV">
+            <objects>
+                <viewController storyboardIdentifier="PhotoPreviewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="ZKT-FN-f83" customClass="PhotoPreviewController" sceneMemberID="viewController">
+                    <layoutGuides>
+                        <viewControllerLayoutGuide type="top" id="O5Y-bH-wqS"/>
+                        <viewControllerLayoutGuide type="bottom" id="02F-ik-riR"/>
+                    </layoutGuides>
+                    <view key="view" contentMode="scaleToFill" id="Awx-LM-8p8">
+                        <rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" pagingEnabled="YES" indicatorStyle="black" maximumZoomScale="3" translatesAutoresizingMaskIntoConstraints="NO" id="cfO-gh-I3B">
+                                <rect key="frame" x="0.0" y="20" width="414" height="716"/>
+                                <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                <connections>
+                                    <outlet property="delegate" destination="ZKT-FN-f83" id="7qH-oS-D8B"/>
+                                </connections>
+                            </scrollView>
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="e1p-74-2TH">
+                                <rect key="frame" x="167" y="30" width="80" height="40"/>
+                                <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="40" id="4Ps-ea-3UH"/>
+                                    <constraint firstAttribute="width" constant="80" id="UW5-cV-Fs1"/>
+                                </constraints>
+                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                <color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
+                                <nil key="highlightedColor"/>
+                            </label>
+                        </subviews>
+                        <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                        <constraints>
+                            <constraint firstAttribute="trailing" secondItem="cfO-gh-I3B" secondAttribute="trailing" id="049-Y8-WxG"/>
+                            <constraint firstItem="e1p-74-2TH" firstAttribute="top" secondItem="cfO-gh-I3B" secondAttribute="top" constant="10" id="5PK-c5-e4G"/>
+                            <constraint firstItem="cfO-gh-I3B" firstAttribute="leading" secondItem="Awx-LM-8p8" secondAttribute="leading" id="BAC-Uw-8qo"/>
+                            <constraint firstItem="e1p-74-2TH" firstAttribute="centerX" secondItem="cfO-gh-I3B" secondAttribute="centerX" id="HtM-c0-zf3"/>
+                            <constraint firstItem="cfO-gh-I3B" firstAttribute="top" secondItem="O5Y-bH-wqS" secondAttribute="bottom" id="z1w-H1-70r"/>
+                            <constraint firstItem="02F-ik-riR" firstAttribute="top" secondItem="cfO-gh-I3B" secondAttribute="bottom" id="z70-Ae-sKo"/>
+                        </constraints>
+                    </view>
+                    <connections>
+                        <outlet property="offsetLabel" destination="e1p-74-2TH" id="jld-AA-EvR"/>
+                        <outlet property="previewScroll" destination="cfO-gh-I3B" id="R6f-6I-nVE"/>
+                    </connections>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="odx-DL-IeR" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="1019" y="71"/>
+        </scene>
+    </scenes>
+</document>

+ 15 - 0
RA Image/RA Image/PhotoListViewController.h

@@ -0,0 +1,15 @@
+//
+//  PhotoListViewController.h
+//  RA Image
+//
+//  Created by Jack on 2017/5/4.
+//  Copyright © 2017年 USAI. All rights reserved.
+//
+
+#import "BasicViewController.h"
+
+@interface PhotoListViewController : BasicViewController
+
+@property (nonatomic,strong) NSMutableArray *photos;
+
+@end

+ 136 - 0
RA Image/RA Image/PhotoListViewController.m

@@ -0,0 +1,136 @@
+//
+//  PhotoListViewController.m
+//  RA Image
+//
+//  Created by Jack on 2017/5/4.
+//  Copyright © 2017年 USAI. All rights reserved.
+//
+
+#import "PhotoListViewController.h"
+#import "PhotoCell.h"
+#import "PhotoPreviewController.h"
+
+@interface PhotoListViewController ()<UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout,PhotoCellDelegate>
+
+@property (strong, nonatomic) IBOutlet UICollectionView *photoCollectionView;
+@property (strong, nonatomic) IBOutlet UIView *toolBarView;
+@property (strong, nonatomic) IBOutlet UIButton *deleteBtn;
+@property (strong, nonatomic) IBOutlet UIButton *uploadBtn;
+
+@property (nonatomic,strong) NSMutableArray *selectedPhotos;
+
+@end
+
+@implementation PhotoListViewController
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    // Do any additional setup after loading the view.
+    
+    UIView *v = [UIView new];
+    [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;
+    
+    self.selectedPhotos = [NSMutableArray array];
+    self.uploadBtn.hidden = YES;
+}
+
+- (void)didReceiveMemoryWarning {
+    [super didReceiveMemoryWarning];
+    // Dispose of any resources that can be recreated.
+}
+
+#pragma mark - Button Action
+
+- (IBAction)deleteBtnClick:(UIButton *)sender {
+    if (self.selectedPhotos.count == 0) {
+        return;
+    }
+
+    for (NSDictionary *item in self.selectedPhotos) {
+        NSString *path = [item objectForKey:@"path"];
+        BOOL check = [[item objectForKey:@"check"] boolValue];
+        if (check) {
+            [RAUtils removeFileAtPath:path];
+            [self.photos removeObject:item];
+        }
+    }
+    [self.selectedPhotos removeAllObjects];
+    
+    [self.photoCollectionView reloadData];
+}
+
+- (IBAction)uploadBtnClick:(UIButton *)sender {
+    if (self.selectedPhotos.count == 0) {
+        return;
+    }
+}
+
+#pragma mark - CollectionView DataSource
+
+- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
+    return self.photos.count;
+}
+
+- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
+    PhotoCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"PhotoCell" forIndexPath:indexPath];
+    cell.delegate = self;
+
+    return cell;
+}
+
+#pragma mark - CollectionView Delegate
+
+- (void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath {
+    NSDictionary *item = [self.photos objectAtIndex:indexPath.row];
+    UIImage *img = [item objectForKey:@"photo"];
+    BOOL check = [[item objectForKey:@"check"] boolValue];
+    
+    PhotoCell *photoCell = (PhotoCell *)cell;
+    photoCell.photo = img;
+    photoCell.checkBtn.selected = check;
+}
+
+- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath {
+    PhotoCell *photoCell = (PhotoCell *)cell;
+    photoCell.photo = nil;
+    photoCell.checkBtn.selected = NO;
+}
+
+- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
+    // 点击Cell不响应需要在viewDidLoad方法中removeFirstResponderTap
+    PhotoPreviewController *previewVC = (PhotoPreviewController *)[self viewControllerInStoryboard:@"PhotoList" withId:@"PhotoPreviewController"];
+    previewVC.photos = self.photos;
+    previewVC.currentIndex = indexPath.row;
+    [self.navigationController pushViewController:previewVC animated:YES];
+}
+
+#pragma mark - Flow Layout
+
+#pragma mark - PhotoCell Delegate
+
+- (void)checkPhotoCell:(PhotoCell *)cell {
+    NSIndexPath *indexPath = [self.photoCollectionView indexPathForCell:cell];
+    NSMutableDictionary *item = [[self.photos objectAtIndex:indexPath.row] mutableCopy];
+    BOOL check = [[item objectForKey:@"check"] boolValue];
+    [item setValue:[NSNumber numberWithBool:!check] forKey:@"check"];
+    [self.photos replaceObjectAtIndex:indexPath.row withObject:item];
+    cell.checkBtn.selected = !check;
+    if (!check) {
+        [self.selectedPhotos addObject:item];
+    } else {
+        [self.selectedPhotos removeObject:item];
+    }
+}
+
+
+@end

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

@@ -0,0 +1,17 @@
+//
+//  PhotoPreviewController.h
+//  RA Image
+//
+//  Created by Jack on 2017/5/4.
+//  Copyright © 2017年 USAI. All rights reserved.
+//
+
+#import "BasicViewController.h"
+
+@interface PhotoPreviewController : BasicViewController
+
+@property (nonatomic,strong) NSArray *photos;
+
+@property (nonatomic,assign) NSUInteger currentIndex;
+
+@end

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

@@ -0,0 +1,115 @@
+//
+//  PhotoPreviewController.m
+//  RA Image
+//
+//  Created by Jack on 2017/5/4.
+//  Copyright © 2017年 USAI. All rights reserved.
+//
+
+#import "PhotoPreviewController.h"
+
+@interface PhotoPreviewController ()<UIScrollViewDelegate>
+
+@property (strong, nonatomic) IBOutlet UIScrollView *previewScroll;
+@property (strong, nonatomic) IBOutlet UILabel *offsetLabel;
+
+@property (nonatomic,assign) BOOL shouldConfigUI;
+
+@end
+
+@implementation PhotoPreviewController
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    // Do any additional setup after loading the view.
+    self.shouldConfigUI = YES;
+    UIView *v = [UIView new];
+    [self.view insertSubview:v atIndex:0];
+    
+    [self removeFirstResponderTap];
+    self.offsetLabel.layer.cornerRadius = 20;
+    self.offsetLabel.layer.masksToBounds = YES;
+
+}
+
+- (void)didReceiveMemoryWarning {
+    [super didReceiveMemoryWarning];
+    // Dispose of any resources that can be recreated.
+}
+
+- (void)viewDidAppear:(BOOL)animated {
+    [super viewDidAppear:animated];
+    if (self.shouldConfigUI) {
+        [self configUI];
+        self.shouldConfigUI = NO;
+    }
+}
+
+- (void)configUI {
+    CGFloat width = CGRectGetWidth(self.previewScroll.bounds);
+    CGFloat height = CGRectGetHeight(self.previewScroll.bounds);
+    for (int i = 0; i < self.photos.count; i++) {
+        UIScrollView *view = [[UIScrollView alloc] initWithFrame:CGRectMake(i * width, 0, width, height)];
+        view.backgroundColor = [UIColor clearColor];
+        view.tag = 1024 + i;
+        view.delegate = self;
+        view.contentSize = view.bounds.size;
+        view.maximumZoomScale = 3;
+        [self.previewScroll addSubview:view];
+        
+        NSDictionary *item = [self.photos objectAtIndex:i];
+        UIImage *img = [item objectForKey:@"photo"];
+        CGFloat w = img.size.width;
+        CGFloat h = img.size.height;
+        
+        float wFactor = w / width;
+        float hFactor = h / height;
+        
+        float factor = 1.0 / MAX(wFactor, hFactor) * 0.8;
+        
+        UIImageView *imgV = [[UIImageView alloc] initWithImage:img];
+        imgV.userInteractionEnabled = YES;
+        imgV.frame = CGRectMake((width - w * factor) * 0.5, (height - h * factor) * 0.5, w * factor, h * factor);
+        [view addSubview:imgV];
+
+        NSString *offset = [NSString stringWithFormat:@"%ld / %ld",self.currentIndex + 1,self.photos.count];
+        self.offsetLabel.text = offset;
+    }
+    self.previewScroll.contentSize = CGSizeMake(width * self.photos.count, 0);
+    self.previewScroll.contentOffset = CGPointMake(width * _currentIndex, 0);
+}
+
+#pragma mark - Orientation
+
+- (BOOL)shouldAutorotate {
+    return NO;
+}
+
+- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
+    return UIInterfaceOrientationPortrait;
+}
+
+- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
+    return UIInterfaceOrientationMaskPortrait;
+}
+
+#pragma mark - ScrollView Delegate
+
+- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
+    if (self.previewScroll == scrollView) {
+        float offset0 = self.previewScroll.contentOffset.x / CGRectGetWidth(self.previewScroll.frame);
+        int offset1 = (int)offset0;
+        if (offset1  == offset0) {
+            self.currentIndex = offset1;
+            NSString *offset = [NSString stringWithFormat:@"%ld / %ld",self.currentIndex + 1,self.photos.count];
+            self.offsetLabel.text = offset;
+        }
+        
+    }
+}
+
+
+
+#pragma mark - Action
+
+@end

+ 14 - 8
RA Image/RA Image/PopModeViewController.m

@@ -15,6 +15,7 @@
 @property (strong, nonatomic) IBOutlet UIButton *imgBtn;
 @property (strong, nonatomic) IBOutlet UILabel *barcodeLabel;
 @property (strong, nonatomic) IBOutlet UIButton *typeBtn;
+@property (strong, nonatomic) IBOutlet UILabel *photoCountLabel;
 
 @end
 
@@ -34,7 +35,7 @@
 #pragma mark - Button Action
 
 - (IBAction)imgBtnClick:(UIButton *)sender {
-    self.barcodeLabel.text = @"img";
+    [self showPhotoList];
 }
 
 - (IBAction)scanBtnClick:(UIButton *)sender {
@@ -61,15 +62,20 @@
     }
 }
 
-- (void)receiveBarcode:(NSString *)code {
-    if (code.length) {
-        self.barcodeLabel.text = [NSString stringWithFormat:@"PIID:%@",code];
-    }
-}
-
 - (void)setBarcode:(NSString *)barcode {
     [super setBarcode:barcode];
-    self.barcodeLabel.text = [NSString stringWithFormat:@"PIID:%@",barcode];
+    self.barcodeLabel.text = [NSString stringWithFormat:@"%@:%@",self.barcodeTitle,barcode];
+}
+
+- (void)setPhotoCount:(NSUInteger)photoCount {
+    [super setPhotoCount:photoCount];
+    NSString *str = nil;
+    if (photoCount > 0) {
+        str = [NSString stringWithFormat:@"%lu Photos",photoCount];
+    } else {
+        str = @"No Photos";
+    }
+    self.photoCountLabel.text = str;
 }
 
 @end

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

@@ -11,5 +11,6 @@
 @interface RootModeCell : UITableViewCell
 
 @property (nonatomic,copy) NSString *mode;
+@property (nonatomic,copy) NSString *code_name;
 
 @end

+ 14 - 8
RA Image/RA Image/RootViewController.m

@@ -83,9 +83,8 @@ static NSString *kLastMode = @"lastChooseMode";
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     if (appDelegate.shouldAutoShowModeVC) {
         if (self.lastChoosedIndex > -1) {
-            NSDictionary *mode = [self.modeList objectAtIndex:self.lastChoosedIndex];
-            NSString *name = [mode objectForKey:@"name"];
-            [self pushCurrentModeController:name];
+            RootModeCell *cell = [self.modeTable cellForRowAtIndexPath:[NSIndexPath indexPathForRow:self.lastChoosedIndex inSection:0]];
+            [self pushCurrentModeController:cell];
         }
         
         appDelegate.shouldAutoShowModeVC = NO;
@@ -104,6 +103,8 @@ static NSString *kLastMode = @"lastChooseMode";
     NSDictionary *mode = [self.modeList objectAtIndex:indexPath.row];
     NSString *name = [mode objectForKey:@"name"];
     cell.mode = name;
+    NSString *codeName = [mode objectForKey:@"code_name"];
+    cell.code_name = codeName;
     NSString *lastChoosedMode = [self userDefaultsValue:kLastMode];
     if (lastChoosedMode.length) {
         if ([lastChoosedMode isEqualToString:name]) {
@@ -120,22 +121,27 @@ static NSString *kLastMode = @"lastChooseMode";
     RootModeCell *cell = [tableView cellForRowAtIndexPath:indexPath];
     NSString *mode = cell.mode;
     [self setUserDefaultsValue:mode forKey:kLastMode];
-    [self pushCurrentModeController:mode];
+    [self pushCurrentModeController:cell];
 }
 
 #pragma mark - Private
 
-- (void)pushCurrentModeController:(NSString *)mode {
-    BasicViewController *modeVC = nil;
-    if ([mode isEqualToString:@"Model"]) {
+- (void)pushCurrentModeController:(RootModeCell *)cell {
+    if (!cell) {
+        return;
+    }
+    BasicModeViewController *modeVC = nil;
+    if ([cell.mode isEqualToString:@"Model"]) {
         ModelModeViewController *vc = (ModelModeViewController *)[self viewControllerInStoryboard:@"Mode" withId:@"ModelModeViewController"];
         modeVC = vc;
-    }else if ([mode isEqualToString:@"POP"]) {
+    }else if ([cell.mode isEqualToString:@"POP"]) {
         PopModeViewController *vc = [[UIStoryboard storyboardWithName:@"Mode" bundle:nil] instantiateViewControllerWithIdentifier:@"PopModeViewController"];
         modeVC = vc;
     }
     
     if (modeVC) {
+        modeVC.barcodeTitle = cell.code_name;
+        modeVC.name = cell.mode;
         [self.navigationController pushViewController:modeVC animated:YES];
     }
     

+ 24 - 0
RA Image/RA Image/TouchImageView.h

@@ -0,0 +1,24 @@
+//
+//  TouchImageView.h
+//  iSales-NPD
+//
+//  Created by Ray on 2/18/16.
+//  Copyright © 2016 United Software Applications, Inc. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+@class TouchImageView;
+@protocol TouchImageViewDelegate <NSObject>
+@required
+- (void)TouchImageViewOnTouche:(TouchImageView *)touchImageView;
+- (void)TouchImageViewOnLongPress:(TouchImageView *)touchImageView;
+@end
+
+@interface TouchImageView : UIImageView
+{
+@private
+    id <TouchImageViewDelegate> __unsafe_unretained delegate;
+}
+
+@property (unsafe_unretained) id <TouchImageViewDelegate> delegate;
+@end

+ 69 - 0
RA Image/RA Image/TouchImageView.m

@@ -0,0 +1,69 @@
+//
+//  TouchImageView.m
+//  iSales-NPD
+//
+//  Created by Ray on 2/18/16.
+//  Copyright © 2016 United Software Applications, Inc. All rights reserved.
+//
+
+#import "TouchImageView.h"
+
+@implementation TouchImageView
+@synthesize delegate;
+
+- (instancetype)initWithFrame:(CGRect)frame
+{
+    self = [super initWithFrame:frame];
+    if (self) {
+        [self becomeFirstResponder];
+        self.userInteractionEnabled=true;
+        
+        
+        UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)];
+        longPress.minimumPressDuration = 0.8; //定义按的时间
+        [self addGestureRecognizer:longPress];
+//        self.layer.borderColor = [UIColor darkGrayColor].CGColor;
+//        self.layer.borderWidth = 1.0;
+    }
+    return self;
+}
+
+- (void)awakeFromNib {
+    [super awakeFromNib];
+    [self becomeFirstResponder];
+    self.userInteractionEnabled=true;
+    self.layer.borderColor = [UIColor darkGrayColor].CGColor;
+    self.layer.borderWidth = 1.0;
+    
+    UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)];
+    longPress.minimumPressDuration = 0.8; //定义按的时间
+    [self addGestureRecognizer:longPress];
+    // Initialization code
+}
+/*
+// Only override drawRect: if you perform custom drawing.
+// An empty implementation adversely affects performance during animation.
+- (void)drawRect:(CGRect)rect {
+    // Drawing code
+}
+*/
+- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
+    
+    if(delegate)
+        [delegate TouchImageViewOnTouche:self];
+
+}
+-(void)longPress:(UILongPressGestureRecognizer*)gestureRecognizer{
+    if (gestureRecognizer.state == UIGestureRecognizerStateBegan) {
+        
+        if(delegate)
+            [delegate TouchImageViewOnLongPress:self];
+        
+    }
+
+}
+//- (void)pressesEnded:(NSSet<UIPress *> *)presses withEvent:(nullable UIPressesEvent *)event
+//{
+//   // event
+//}
+@end