Просмотр исходного кода

1.修改Photo Preview,增加缩放功能和禁止视图旋转。
2.完成Manufacturer功能。

Pen Li 9 лет назад
Родитель
Сommit
0adfd38a8a

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

@@ -13,6 +13,9 @@
 		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 */; };
+		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 */; };
 		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 */; };
@@ -66,6 +69,12 @@
 		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>"; };
+		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>"; };
+		42A829C21EBC0F8300898B8A /* ManufacturerListController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ManufacturerListController.m; sourceTree = "<group>"; };
+		42A829C51EBC0FAC00898B8A /* ManufacturerCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ManufacturerCell.h; sourceTree = "<group>"; };
+		42A829C61EBC0FAC00898B8A /* ManufacturerCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ManufacturerCell.m; 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>"; };
@@ -185,10 +194,22 @@
 			children = (
 				426E6B251EB85C4200942BE1 /* ModelModeViewController.h */,
 				426E6B261EB85C4200942BE1 /* ModelModeViewController.m */,
+				42A829C11EBC0F8300898B8A /* ManufacturerListController.h */,
+				42A829C21EBC0F8300898B8A /* ManufacturerListController.m */,
+				42A829C41EBC0F8D00898B8A /* view */,
 			);
 			name = ModelMode;
 			sourceTree = "<group>";
 		};
+		42A829C41EBC0F8D00898B8A /* view */ = {
+			isa = PBXGroup;
+			children = (
+				42A829C51EBC0FAC00898B8A /* ManufacturerCell.h */,
+				42A829C61EBC0FAC00898B8A /* ManufacturerCell.m */,
+			);
+			name = view;
+			sourceTree = "<group>";
+		};
 		42BC2CFC1EBAC3D40016B30D /* PhotoList */ = {
 			isa = PBXGroup;
 			children = (
@@ -389,6 +410,8 @@
 				42E1B10E1EB1E93E00EEF27C /* Root */,
 				71DCDC3A1EAF234E00BA045A /* AppDelegate.h */,
 				71DCDC3B1EAF234E00BA045A /* AppDelegate.m */,
+				42A829BE1EBC027100898B8A /* RootNavigationController.h */,
+				42A829BF1EBC027100898B8A /* RootNavigationController.m */,
 				71DCDC401EAF234E00BA045A /* Main.storyboard */,
 				71DCDC431EAF234E00BA045A /* Assets.xcassets */,
 				71DCDC451EAF234E00BA045A /* LaunchScreen.storyboard */,
@@ -509,7 +532,9 @@
 				71114AB51EB1C5C800D2200C /* NSData+CommonCrypto.m in Sources */,
 				71114AC71EB1C73B00D2200C /* mztools.c in Sources */,
 				426E6B271EB85C4200942BE1 /* ModelModeViewController.m in Sources */,
+				42A829C71EBC0FAC00898B8A /* ManufacturerCell.m in Sources */,
 				71DCDC3F1EAF234E00BA045A /* RootViewController.m in Sources */,
+				42A829C01EBC027100898B8A /* RootNavigationController.m in Sources */,
 				42E1B1081EB1D9B100EEF27C /* LoginSettingViewController.m in Sources */,
 				71114AC81EB1C73B00D2200C /* unzip.c in Sources */,
 				71114AA01EB1C3DE00D2200C /* NetworkUtils.m in Sources */,
@@ -519,6 +544,7 @@
 				71114AF31EB2DEF900D2200C /* SCShapeView.m in Sources */,
 				71114AF21EB2DEF900D2200C /* ScannerViewController.m in Sources */,
 				42BC2D091EBAC75F0016B30D /* TouchImageView.m in Sources */,
+				42A829C31EBC0F8300898B8A /* ManufacturerListController.m in Sources */,
 				71114AB61EB1C5C800D2200C /* NSString+Base64.m in Sources */,
 				71114AA61EB1C50D00D2200C /* RAUtils.m in Sources */,
 				71DCDC3C1EAF234E00BA045A /* AppDelegate.m in Sources */,

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


+ 2 - 2
RA Image/RA Image/Base.lproj/Main.storyboard

@@ -10,10 +10,10 @@
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <scenes>
-        <!--Navigation Controller-->
+        <!--Root Navigation Controller-->
         <scene sceneID="7ND-eH-sRU">
             <objects>
-                <navigationController id="zf9-JT-Kr2" sceneMemberID="viewController">
+                <navigationController id="zf9-JT-Kr2" customClass="RootNavigationController" sceneMemberID="viewController">
                     <navigationBar key="navigationBar" contentMode="scaleToFill" id="fQ0-CT-SJq">
                         <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
                         <autoresizingMask key="autoresizingMask"/>

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

@@ -32,6 +32,10 @@
 }
 
 - (void)showPhotoList {
+    if (!self.photos.count) {
+        [RAUtils message_alert:@"There is no photo" title:@"Note" controller:self];
+        return;
+    }
     PhotoListViewController *photoListVC = (PhotoListViewController *)[self viewControllerInStoryboard:@"PhotoList" withId:@"PhotoListViewController"];
     photoListVC.photos = [self.photos mutableCopy];
     [self.navigationController pushViewController:photoListVC animated:YES];
@@ -154,27 +158,28 @@
 #pragma mark - Public Method
 
 - (void)clickCameraButton {
-    __weak typeof(self) weakself = self;
-    
-    
-    UIAlertController *aler = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
-    UIAlertAction *library = [UIAlertAction actionWithTitle:@"Camera" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-        [weakself showCamera];
-    }];
-    
-    UIAlertAction *camera = [UIAlertAction actionWithTitle:@"Photo Library" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-        [weakself showPhotoLibrary];
-    }];
-    
-    UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
-        
-    }];
-    
-    [aler addAction:library];
-    [aler addAction:camera];
-    [aler addAction:cancel];
-    
-    [self presentViewController:aler animated:YES completion:nil];
+//    __weak typeof(self) weakself = self;
+//    
+//    
+//    UIAlertController *aler = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
+//    UIAlertAction *library = [UIAlertAction actionWithTitle:@"Camera" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+//        [weakself showCamera];
+//    }];
+//    
+//    UIAlertAction *camera = [UIAlertAction actionWithTitle:@"Photo Library" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+//        [weakself showPhotoLibrary];
+//    }];
+//    
+//    UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
+//        
+//    }];
+//    
+//    [aler addAction:library];
+//    [aler addAction:camera];
+//    [aler addAction:cancel];
+//    
+//    [self presentViewController:aler animated:YES completion:nil];
+    [self showCamera];
 }
 
 #pragma mark - Image Picker Delegate

+ 16 - 0
RA Image/RA Image/ManufacturerCell.h

@@ -0,0 +1,16 @@
+//
+//  ManufacturerCell.h
+//  RA Image
+//
+//  Created by Jack on 2017/5/5.
+//  Copyright © 2017年 USAI. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface ManufacturerCell : UITableViewCell
+
+
+@property (strong, nonatomic) IBOutlet UITextField *manufacturerLabel;
+
+@end

+ 24 - 0
RA Image/RA Image/ManufacturerCell.m

@@ -0,0 +1,24 @@
+//
+//  ManufacturerCell.m
+//  RA Image
+//
+//  Created by Jack on 2017/5/5.
+//  Copyright © 2017年 USAI. All rights reserved.
+//
+
+#import "ManufacturerCell.h"
+
+@implementation ManufacturerCell
+
+- (void)awakeFromNib {
+    [super awakeFromNib];
+    // Initialization code
+}
+
+- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
+    [super setSelected:selected animated:animated];
+
+    // Configure the view for the selected state
+}
+
+@end

+ 16 - 0
RA Image/RA Image/ManufacturerListController.h

@@ -0,0 +1,16 @@
+//
+//  ManufacturerListController.h
+//  RA Image
+//
+//  Created by Jack on 2017/5/5.
+//  Copyright © 2017年 USAI. All rights reserved.
+//
+
+#import "BasicViewController.h"
+
+@interface ManufacturerListController : BasicViewController
+
+@property (nonatomic,strong) NSArray *manufacturerList;
+@property (nonatomic,copy) void(^returnValue)(NSString *value);
+
+@end

+ 67 - 0
RA Image/RA Image/ManufacturerListController.m

@@ -0,0 +1,67 @@
+//
+//  ManufacturerListController.m
+//  RA Image
+//
+//  Created by Jack on 2017/5/5.
+//  Copyright © 2017年 USAI. All rights reserved.
+//
+
+#import "ManufacturerListController.h"
+#import "ManufacturerCell.h"
+
+@interface ManufacturerListController ()<UITableViewDelegate,UITableViewDataSource>
+
+@property (strong, nonatomic) IBOutlet UITableView *manufacturerTable;
+
+@end
+
+@implementation ManufacturerListController
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    // Do any additional setup after loading the view.
+    [self removeFirstResponderTap];
+    [self.view insertSubview:[UIView new] atIndex:0];
+    
+    self.manufacturerTable.tableFooterView = [UIView new];
+}
+
+- (void)didReceiveMemoryWarning {
+    [super didReceiveMemoryWarning];
+    // Dispose of any resources that can be recreated.
+}
+
+#pragma mark - Data Source
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+    return self.manufacturerList.count;
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+    ManufacturerCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ManufacturerCell"];
+    
+    return cell;
+}
+
+#pragma mark - Delegate
+
+- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
+    ManufacturerCell *manuCell = (ManufacturerCell *)cell;
+    manuCell.manufacturerLabel.text = [self.manufacturerList objectAtIndex:indexPath.row];
+}
+
+- (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
+    ManufacturerCell *manuCell = (ManufacturerCell *)cell;
+    manuCell.manufacturerLabel.text = nil;
+}
+
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+    ManufacturerCell *cell = [tableView cellForRowAtIndexPath:indexPath];
+    if (self.returnValue) {
+        self.returnValue(cell.manufacturerLabel.text);
+    }
+    [self.navigationController popViewControllerAnimated:YES];
+}
+
+
+@end

+ 84 - 20
RA Image/RA Image/Mode.storyboard

@@ -1,6 +1,6 @@
 <?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="landscape">
+    <device id="retina5_5" orientation="portrait">
         <adaptation id="fullscreen"/>
     </device>
     <dependencies>
@@ -21,11 +21,11 @@
                         <viewControllerLayoutGuide type="bottom" id="8eX-wZ-j58"/>
                     </layoutGuides>
                     <view key="view" contentMode="scaleToFill" id="QEg-TT-jt8">
-                        <rect key="frame" x="0.0" y="0.0" width="736" height="414"/>
+                        <rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="tx6-Jq-V78">
-                                <rect key="frame" x="50" y="57" width="300" height="300"/>
+                                <rect key="frame" x="67" y="50" width="280" height="280"/>
                                 <color key="backgroundColor" red="1" green="0.36503490374616099" blue="0.7594767167726002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="280" id="0HU-zi-itA"/>
@@ -70,7 +70,7 @@
                                 </connections>
                             </button>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6jr-Xw-2tL">
-                                <rect key="frame" x="380" y="297" width="54" height="60"/>
+                                <rect key="frame" x="67" y="629" width="60" height="60"/>
                                 <color key="backgroundColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
                                 <constraints>
                                     <constraint firstAttribute="width" constant="60" id="K6W-Tz-wcn"/>
@@ -96,7 +96,7 @@
                                 </connections>
                             </button>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="NAz-nK-Hgz">
-                                <rect key="frame" x="521" y="297" width="54" height="60"/>
+                                <rect key="frame" x="177" y="629" width="60" height="60"/>
                                 <color key="backgroundColor" red="0.45257410590000002" green="1" blue="0.65812935640000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="60" id="o6H-g4-n4a"/>
@@ -107,13 +107,13 @@
                                 </connections>
                             </button>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="PIID:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7rM-i2-eHr">
-                                <rect key="frame" x="380" y="57" width="336" height="27"/>
+                                <rect key="frame" x="67" y="353" width="280" height="27"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                 <nil key="textColor"/>
                                 <nil key="highlightedColor"/>
                             </label>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="jte-R6-noU">
-                                <rect key="frame" x="662" y="297" width="54" height="60"/>
+                                <rect key="frame" x="287" y="629" width="60" height="60"/>
                                 <color key="backgroundColor" red="0.25435081980000002" green="0.75957768849999996" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <state key="normal" title="Upload"/>
                                 <connections>
@@ -121,7 +121,7 @@
                                 </connections>
                             </button>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Rvg-OG-bQ0">
-                                <rect key="frame" x="686" y="57" width="30" height="27"/>
+                                <rect key="frame" x="317" y="353" width="30" height="27"/>
                                 <constraints>
                                     <constraint firstAttribute="width" constant="30" id="ART-XN-Nuf"/>
                                 </constraints>
@@ -134,7 +134,7 @@
                                 </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"/>
+                                <rect key="frame" x="67" y="50" width="280" height="20"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="20" id="mgg-Dx-4kA"/>
                                 </constraints>
@@ -334,11 +334,11 @@
                         <viewControllerLayoutGuide type="bottom" id="H4g-H8-jhv"/>
                     </layoutGuides>
                     <view key="view" contentMode="scaleToFill" id="o96-bU-q7q">
-                        <rect key="frame" x="0.0" y="0.0" width="736" height="414"/>
+                        <rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="i3W-S0-nip">
-                                <rect key="frame" x="50" y="84" width="300" height="300"/>
+                                <rect key="frame" x="67" y="70" width="280" height="280"/>
                                 <color key="backgroundColor" red="1" green="0.36503490370000002" blue="0.75947671679999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="200" id="P4F-3c-O90"/>
@@ -383,7 +383,7 @@
                                 </connections>
                             </button>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8cw-MJ-Ahc">
-                                <rect key="frame" x="370" y="324" width="54" height="60"/>
+                                <rect key="frame" x="67" y="629" width="60" height="60"/>
                                 <color key="backgroundColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
                                 <constraints>
                                     <constraint firstAttribute="width" constant="60" id="qWl-ce-tQ1"/>
@@ -409,7 +409,7 @@
                                 </connections>
                             </button>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="951-qi-5kI">
-                                <rect key="frame" x="516" y="324" width="54" height="60"/>
+                                <rect key="frame" x="177" y="629" width="60" height="60"/>
                                 <color key="backgroundColor" red="0.45257410590000002" green="1" blue="0.65812935640000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="60" id="Vly-i4-6f7"/>
@@ -420,7 +420,7 @@
                                 </connections>
                             </button>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="xAA-t1-vMd">
-                                <rect key="frame" x="662" y="324" width="54" height="60"/>
+                                <rect key="frame" x="287" y="629" width="60" height="60"/>
                                 <color key="backgroundColor" red="0.25435081980000002" green="0.75957768849999996" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <state key="normal" title="Upload"/>
                                 <connections>
@@ -428,18 +428,18 @@
                                 </connections>
                             </button>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="gY5-Tk-ev9">
-                                <rect key="frame" x="49.666666666666657" y="49" width="300" height="30"/>
+                                <rect key="frame" x="66.666666666666686" y="32" width="280" height="30"/>
                                 <color key="backgroundColor" red="0.63798287620000005" green="0.61995456810000005" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="30" id="swK-1l-5tG"/>
                                 </constraints>
-                                <state key="normal" title="Manufacture"/>
+                                <state key="normal" title="Manufacturer"/>
                                 <connections>
                                     <action selector="manufactureBtnClick:" destination="7Iz-ry-1hB" eventType="touchUpInside" id="pYl-Hw-jI2"/>
                                 </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.66666666666663" width="346" height="183.33333333333337"/>
+                                <rect key="frame" x="67" y="396" width="280" height="213"/>
                                 <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                 <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
@@ -448,13 +448,13 @@
                                 </connections>
                             </textView>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Model:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="RZK-hh-toU">
-                                <rect key="frame" x="370" y="84" width="346" height="27"/>
+                                <rect key="frame" x="67" y="360" width="280" height="27"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                 <nil key="textColor"/>
                                 <nil key="highlightedColor"/>
                             </label>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="A3O-9b-0D7">
-                                <rect key="frame" x="686" y="84" width="30" height="27"/>
+                                <rect key="frame" x="317" y="360" width="30" height="27"/>
                                 <constraints>
                                     <constraint firstAttribute="width" constant="30" id="gjf-JE-DIU"/>
                                 </constraints>
@@ -467,7 +467,7 @@
                                 </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"/>
+                                <rect key="frame" x="67" y="70" width="280" height="20"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="20" id="gr4-N2-NFP"/>
                                 </constraints>
@@ -732,5 +732,69 @@
             </objects>
             <point key="canvasLocation" x="773.60000000000002" y="80.50974512743629"/>
         </scene>
+        <!--Manufacturer List Controller-->
+        <scene sceneID="6ZO-pV-X2b">
+            <objects>
+                <viewController storyboardIdentifier="ManufacturerListController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="q1h-Xe-Vwq" customClass="ManufacturerListController" sceneMemberID="viewController">
+                    <layoutGuides>
+                        <viewControllerLayoutGuide type="top" id="FL0-AE-b8P"/>
+                        <viewControllerLayoutGuide type="bottom" id="SjT-JB-7Rp"/>
+                    </layoutGuides>
+                    <view key="view" contentMode="scaleToFill" id="MEt-dL-S54">
+                        <rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="l46-Cv-WLh">
+                                <rect key="frame" x="0.0" y="20" width="414" height="716"/>
+                                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                <prototypes>
+                                    <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="ManufacturerCell" id="Scm-6H-13W" customClass="ManufacturerCell">
+                                        <rect key="frame" x="0.0" y="28" width="414" 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="414" 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.666666666666664"/>
+                                                    <nil key="textColor"/>
+                                                    <fontDescription key="fontDescription" type="system" pointSize="15"/>
+                                                    <textInputTraits key="textInputTraits"/>
+                                                </textField>
+                                            </subviews>
+                                            <constraints>
+                                                <constraint firstAttribute="trailing" secondItem="NYL-AQ-1Xx" secondAttribute="trailing" id="FNA-8b-l15"/>
+                                                <constraint firstItem="NYL-AQ-1Xx" firstAttribute="leading" secondItem="WlG-lg-3va" secondAttribute="leading" id="GLe-SY-00l"/>
+                                                <constraint firstAttribute="bottom" secondItem="NYL-AQ-1Xx" secondAttribute="bottom" id="RAU-9M-MFJ"/>
+                                                <constraint firstItem="NYL-AQ-1Xx" firstAttribute="top" secondItem="WlG-lg-3va" secondAttribute="top" id="UAe-Zr-Nud"/>
+                                            </constraints>
+                                        </tableViewCellContentView>
+                                        <connections>
+                                            <outlet property="manufacturerLabel" destination="NYL-AQ-1Xx" id="DwR-Is-0W8"/>
+                                        </connections>
+                                    </tableViewCell>
+                                </prototypes>
+                                <connections>
+                                    <outlet property="dataSource" destination="q1h-Xe-Vwq" id="JnL-Zg-Yur"/>
+                                    <outlet property="delegate" destination="q1h-Xe-Vwq" id="7PR-7E-A5t"/>
+                                </connections>
+                            </tableView>
+                        </subviews>
+                        <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                        <constraints>
+                            <constraint firstItem="SjT-JB-7Rp" firstAttribute="top" secondItem="l46-Cv-WLh" secondAttribute="bottom" id="5jN-Ph-8Mr"/>
+                            <constraint firstItem="l46-Cv-WLh" firstAttribute="top" secondItem="FL0-AE-b8P" secondAttribute="bottom" id="TQr-bR-fOl"/>
+                            <constraint firstAttribute="trailing" secondItem="l46-Cv-WLh" secondAttribute="trailing" id="wBh-wk-O2e"/>
+                            <constraint firstItem="l46-Cv-WLh" firstAttribute="leading" secondItem="MEt-dL-S54" secondAttribute="leading" id="yYJ-QH-0yl"/>
+                        </constraints>
+                    </view>
+                    <connections>
+                        <outlet property="manufacturerTable" destination="l46-Cv-WLh" id="7vd-tq-kLI"/>
+                    </connections>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="8ZD-1F-1F1" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="1814" y="162"/>
+        </scene>
     </scenes>
 </document>

+ 2 - 0
RA Image/RA Image/ModelModeViewController.h

@@ -10,4 +10,6 @@
 
 @interface ModelModeViewController : BasicModeViewController
 
+@property (nonatomic,strong) NSArray *manufacturerList;
+
 @end

+ 21 - 2
RA Image/RA Image/ModelModeViewController.m

@@ -10,6 +10,7 @@
 #import "JLKeyboardListener.h"
 #import <AVFoundation/AVFoundation.h>
 #import <AssetsLibrary/AssetsLibrary.h>
+#import "ManufacturerListController.h"
 
 @interface ModelModeViewController ()<UITextViewDelegate>
 
@@ -23,7 +24,7 @@
 @property (strong, nonatomic) IBOutlet UIButton *typeBtn;
 @property (strong, nonatomic) IBOutlet UILabel *photoCountLabel;
 
-
+@property (nonatomic,copy) NSString *manufacturer;
 
 @end
 
@@ -35,6 +36,8 @@
     self.noteTextView.layer.borderColor = [UIColor blackColor].CGColor;
     self.noteTextView.layer.borderWidth = 1.0f;    
     [self registListenKeyboard];
+    
+    self.manufacturerList = @[@"New Pacific Direct,inc",@"HMLG",@"Red Ant",@"Facebook"]; // Test Value
 }
 
 
@@ -51,7 +54,16 @@
 }
 
 - (IBAction)manufactureBtnClick:(UIButton *)sender {
-    self.barcodeLabel.text = @"manu";
+    ManufacturerListController *manuVC = (ManufacturerListController *)[self viewControllerInStoryboard:@"Mode" withId:@"ManufacturerListController"];
+    __weak typeof(self) weakself = self;
+    manuVC.returnValue = ^(NSString *value) {
+        if (weakself) {
+            __strong typeof(weakself) strongself = weakself;
+            strongself.manufacturer = value;
+        }
+    };
+    manuVC.manufacturerList = self.manufacturerList;
+    [self.navigationController pushViewController:manuVC animated:YES];
 }
 
 - (IBAction)scanBtnClick:(UIButton *)sender {
@@ -69,6 +81,13 @@
     [self showBarcodeInput];
 }
 
+#pragma mark - Setter
+
+- (void)setManufacturer:(NSString *)manufacturer {
+    _manufacturer = manufacturer;
+    [self.manufactureBtn setTitle:[NSString stringWithFormat:@"Manufacturer:%@",manufacturer] forState:UIControlStateNormal];
+}
+
 #pragma mark - Super Method
 
 - (void)receiveImage:(UIImage *)img {

+ 71 - 45
RA Image/RA Image/PhotoPreviewController.m

@@ -21,21 +21,17 @@
 
 - (void)viewDidLoad {
     [super viewDidLoad];
-    // Do any additional setup after loading the view.
+    // Do any additional setup after loading the view, typically from a nib.
+    [self removeFirstResponderTap];
     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];
@@ -43,73 +39,103 @@
         [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];
-        
+        CGRect frame = CGRectMake(i * width, 0, width, height);
+        UIScrollView *sc = [[UIScrollView alloc] initWithFrame:frame];
+        sc.tag = 1024 + i;
+        sc.delegate = self;
+//        sc.maximumZoomScale = 5; // pinch手势不能设置此值
+        [self.previewScroll addSubview:sc];
+
         NSDictionary *item = [self.photos objectAtIndex:i];
         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;
         
-        float wFactor = w / width;
-        float hFactor = h / height;
-        
-        float factor = 1.0 / MAX(wFactor, hFactor) * 0.8;
+        frame = CGRectMake((width - w * factor) * 0.5, (height - h * factor) * 0.5, w * factor, h * factor);
+        UIImageView *iv = [[UIImageView alloc] initWithImage:img];
+        iv.frame = frame;
+        iv.userInteractionEnabled = YES;
+        [sc addSubview:iv];
+        sc.contentSize = sc.frame.size;
         
-        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;
+        UIPinchGestureRecognizer *pinch = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(imageViewPinch:)];
+        [iv addGestureRecognizer:pinch];
     }
-    self.previewScroll.contentSize = CGSizeMake(width * self.photos.count, 0);
+    self.previewScroll.contentSize = CGSizeMake(self.photos.count * width, 0);
     self.previewScroll.contentOffset = CGPointMake(width * _currentIndex, 0);
+    
+    self.currentIndex = self.currentIndex;//更新视图
+    
 }
 
-#pragma mark - Orientation
-
-- (BOOL)shouldAutorotate {
-    return NO;
-}
-
-- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
-    return UIInterfaceOrientationPortrait;
-}
+#pragma mark - Setter
 
-- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
-    return UIInterfaceOrientationMaskPortrait;
+- (void)setCurrentIndex:(NSUInteger)currentIndex {
+    _currentIndex = currentIndex;
+    NSString *offset = [NSString stringWithFormat:@"%ld / %ld",self.currentIndex + 1,self.photos.count];
+    self.offsetLabel.text = offset;
 }
 
 #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;
+    if (scrollView == self.previewScroll) {
+        CGFloat x = scrollView.contentOffset.x / scrollView.frame.size.width;
+        int idx = (int)x;
+        if (idx == x) {
+            self.currentIndex = idx;
         }
+    } else {
         
     }
 }
 
+#pragma mark - pinch
+
+- (void)imageViewPinch:(UIPinchGestureRecognizer *)pinch{
+    
+    UIScrollView *scroll = [self.previewScroll viewWithTag:1024 + self.currentIndex];
+    UIImageView *imgv = [scroll.subviews firstObject];
+    
+    CGFloat width = scroll.frame.size.width;
+    CGFloat height = scroll.frame.size.height;
+    
+    imgv.transform = CGAffineTransformScale(imgv.transform, pinch.scale, pinch.scale);
+    CGSize size = scroll.contentSize;
+    //    size.width = size.width * pinch.scale;
+    //    size.height = size.height * pinch.scale;
+    size = imgv.frame.size;// bounds 和 frame 不一致
+    
+    if (size.width < width) {
+        size.width = width;
+    }
+    if (size.height < height) {
+        size.height = height;
+    }
+    
+    scroll.contentSize = size;
+    scroll.contentOffset = CGPointMake((size.width - width) * 0.5, (size.height - height) * 0.5);
+    // 保持在屏幕中心
+    CGPoint offset = scroll.contentOffset;
+    CGFloat x = offset.x + width * 0.5;
+    CGFloat y = offset.y + height * 0.5;
+    imgv.center = CGPointMake(x, y);
+    
+    pinch.scale = 1;
+}
 
 
-#pragma mark - Action
 
 @end

+ 13 - 0
RA Image/RA Image/RootNavigationController.h

@@ -0,0 +1,13 @@
+//
+//  RootNavigationController.h
+//  RA Image
+//
+//  Created by Jack on 2017/5/5.
+//  Copyright © 2017年 USAI. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface RootNavigationController : UINavigationController
+
+@end

+ 37 - 0
RA Image/RA Image/RootNavigationController.m

@@ -0,0 +1,37 @@
+//
+//  RootNavigationController.m
+//  RA Image
+//
+//  Created by Jack on 2017/5/5.
+//  Copyright © 2017年 USAI. All rights reserved.
+//
+
+#import "RootNavigationController.h"
+#import "PhotoPreviewController.h"
+
+@interface RootNavigationController ()
+
+@end
+
+@implementation RootNavigationController
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    // Do any additional setup after loading the view.
+}
+
+- (void)didReceiveMemoryWarning {
+    [super didReceiveMemoryWarning];
+    // Dispose of any resources that can be recreated.
+}
+
+- (BOOL)shouldAutorotate {
+    if ([self.topViewController isKindOfClass:[PhotoPreviewController class]]) { // 图片预览保持竖屏
+        return NO;
+    }
+    return YES;
+}
+
+
+
+@end

+ 3 - 0
RA Image/RA Image/RootViewController.m

@@ -130,9 +130,12 @@ static NSString *kLastMode = @"lastChooseMode";
     if (!cell) {
         return;
     }
+    NSIndexPath *indexPath = [self.modeTable indexPathForCell:cell];
+    NSDictionary *mode = [self.modeList objectAtIndex:indexPath.row];
     BasicModeViewController *modeVC = nil;
     if ([cell.mode isEqualToString:@"Model"]) {
         ModelModeViewController *vc = (ModelModeViewController *)[self viewControllerInStoryboard:@"Mode" withId:@"ModelModeViewController"];
+        vc.manufacturerList = [mode objectForKey:@"manifacturer"];
         modeVC = vc;
     }else if ([cell.mode isEqualToString:@"POP"]) {
         PopModeViewController *vc = [[UIStoryboard storyboardWithName:@"Mode" bundle:nil] instantiateViewControllerWithIdentifier:@"PopModeViewController"];