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

1.修改POP模式用户界面,适配Plus。
2.完成Model模式用户界面搭建。
3.所有控制器增加键盘事件监听。
4.完成POP模式和Model模式下Scan和Camera功能。

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

+ 12 - 4
RA Image/BasicViewController.h

@@ -12,17 +12,25 @@
 #import "RAINetwork.h"
 #import "AppDelegate.h"
 #import "RAUtils.h"
+#import "JLKeyboardListener.h"
 
 extern NSString *const LogoutNotification;
 
-@interface BasicViewController : UIViewController
+@interface BasicViewController : UIViewController<JLKeyboardListenerDelegate>
 
+#pragma mark - Property
+@property (nonatomic,weak) UIView *currentFirstResponder;
 @property (nonatomic,strong,readonly) NSNotificationCenter *notificationCenter;
 
-- (id)userDefaultsValue:(NSString *)key;
+#pragma mark - Method
 
+- (id)userDefaultsValue:(NSString *)key;
 - (void)setUserDefaultsValue:(id)value forKey:(NSString *)key;
-
 - (void)userLogout:(NSNotification *)notification;
-
+- (UIViewController *)viewControllerInStoryboard:(NSString *)storyboard withId:(NSString *)storyboardId;
+- (void)tapResignFirstResponder:(UITapGestureRecognizer *)tap;
+- (void)removeFirstResponderTap;
+- (void)registListenKeyboard;
+- (void)startListenKeyboard;
+- (void)stopListenKeyboard;
 @end

+ 101 - 2
RA Image/BasicViewController.m

@@ -12,6 +12,10 @@ NSString *const LogoutNotification = @"LogouNotification";
 
 @interface BasicViewController ()
 
+@property (nonatomic,strong) JLKeyboardListener *keyboardListener;
+@property (nonatomic,assign) CGFloat translateY;
+@property (nonatomic,strong) UITapGestureRecognizer *firstResponderTap;
+
 @end
 
 @implementation BasicViewController
@@ -31,8 +35,23 @@ NSString *const LogoutNotification = @"LogouNotification";
 - (void)viewDidLoad {
     [super viewDidLoad];
     // Do any additional setup after loading the view.
-    
-    
+   
+    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapResignFirstResponder:)];
+    [self.view addGestureRecognizer:tap];
+    self.firstResponderTap = tap;
+}
+
+- (void)viewWillAppear:(BOOL)animated {
+    [super viewWillAppear:animated];
+    [self startListenKeyboard];
+}
+
+- (void)viewWillDisappear:(BOOL)animated {
+    [super viewWillDisappear:animated];
+    if (self.currentFirstResponder) {
+        [self tapResignFirstResponder:nil];
+    }
+    [self stopListenKeyboard];
 }
 
 - (void)didReceiveMemoryWarning {
@@ -62,5 +81,85 @@ NSString *const LogoutNotification = @"LogouNotification";
     }
 }
 
+- (UIViewController *)viewControllerInStoryboard:(NSString *)storyboard withId:(NSString *)storyboardId {
+    return [[UIStoryboard storyboardWithName:storyboard bundle:nil] instantiateViewControllerWithIdentifier:storyboardId];
+}
+
+
+#pragma mark - First Responder
+
+- (void)tapResignFirstResponder:(UITapGestureRecognizer *)tap {
+    if (self.currentFirstResponder) {
+        [self.currentFirstResponder resignFirstResponder];
+        self.currentFirstResponder = nil;
+        self.translateY = 0;
+    }
+}
+
+- (void)removeFirstResponderTap {
+    if (self.firstResponderTap) {
+        [self.view removeGestureRecognizer:self.firstResponderTap];
+        self.firstResponderTap = nil;
+    }
+}
+
+#pragma mark - Keyboard Listener
+
+- (void)registListenKeyboard {
+    self.keyboardListener = [[JLKeyboardListener alloc] init];
+    self.keyboardListener.delegate = self;
+}
+
+- (void)startListenKeyboard {
+    if (self.keyboardListener) {
+        [self.keyboardListener startListen];
+    }
+}
+
+- (void)stopListenKeyboard {
+    if (self.keyboardListener) {
+        [self.keyboardListener stopListen];
+    }
+}
+
+#pragma mark - KeyboardListener Delegate
+
+- (void)keyboardWillShowHeight:(CGFloat)height withDuration:(NSTimeInterval)duration {
+    if (!self.currentFirstResponder) {
+        return;
+    }
+    CGFloat y = CGRectGetMaxY(self.currentFirstResponder.frame);
+    CGFloat maxH = CGRectGetMaxY(self.view.frame);
+    if (maxH - height < y) {
+        self.translateY = maxH - height - y;
+        
+        CGAffineTransform transform = self.view.transform;
+        transform = CGAffineTransformTranslate(transform, 0, self.translateY);
+        self.view.transform = transform;
+    }
+    
+}
+
+- (void)keyboardWillHideHeight:(CGFloat)height withDuration:(NSTimeInterval)duration {
+    self.view.transform = CGAffineTransformIdentity;
+}
+
+- (void)keyboardWillChangeHeight:(CGFloat)height offset:(CGFloat)heightOffset withDuration:(NSTimeInterval)duration {
+    if (!self.currentFirstResponder) {
+        return;
+    }
+    self.view.transform = CGAffineTransformIdentity;
+    CGFloat y = CGRectGetMaxY(self.currentFirstResponder.frame);
+    CGFloat maxH = CGRectGetMaxY(self.view.frame);
+    if (maxH - height < y) {
+        self.translateY = maxH - height - y;
+        CGAffineTransform transform = self.view.transform;
+        transform = CGAffineTransformTranslate(transform, 0, self.translateY);
+        self.view.transform = transform;
+    }
+    
+}
+
+
 
 @end

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

@@ -7,6 +7,8 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
+		42056E7E1EB989AB0010597A /* JLKeyboardListener.m in Sources */ = {isa = PBXBuildFile; fileRef = 42056E7D1EB989AB0010597A /* JLKeyboardListener.m */; };
+		42056E871EB9CF5D0010597A /* BasicModeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 42056E861EB9CF5D0010597A /* BasicModeViewController.m */; };
 		426E6B1F1EB8558400942BE1 /* RootModeCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 426E6B1E1EB8558400942BE1 /* RootModeCell.m */; };
 		426E6B241EB85C2B00942BE1 /* PopModeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 426E6B231EB85C2B00942BE1 /* PopModeViewController.m */; };
 		426E6B271EB85C4200942BE1 /* ModelModeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 426E6B261EB85C4200942BE1 /* ModelModeViewController.m */; };
@@ -48,6 +50,10 @@
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
+		42056E7C1EB989AB0010597A /* JLKeyboardListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JLKeyboardListener.h; sourceTree = "<group>"; };
+		42056E7D1EB989AB0010597A /* JLKeyboardListener.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JLKeyboardListener.m; sourceTree = "<group>"; };
+		42056E851EB9CF5D0010597A /* BasicModeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BasicModeViewController.h; sourceTree = "<group>"; };
+		42056E861EB9CF5D0010597A /* BasicModeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BasicModeViewController.m; sourceTree = "<group>"; };
 		426E6B1D1EB8558400942BE1 /* RootModeCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootModeCell.h; sourceTree = "<group>"; };
 		426E6B1E1EB8558400942BE1 /* RootModeCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RootModeCell.m; sourceTree = "<group>"; };
 		426E6B221EB85C2B00942BE1 /* PopModeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PopModeViewController.h; sourceTree = "<group>"; };
@@ -133,6 +139,15 @@
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
+		42056E7B1EB989AB0010597A /* KeyboardListener */ = {
+			isa = PBXGroup;
+			children = (
+				42056E7C1EB989AB0010597A /* JLKeyboardListener.h */,
+				42056E7D1EB989AB0010597A /* JLKeyboardListener.m */,
+			);
+			path = KeyboardListener;
+			sourceTree = "<group>";
+		};
 		426E6B1C1EB8555800942BE1 /* view */ = {
 			isa = PBXGroup;
 			children = (
@@ -225,6 +240,7 @@
 		71114AA71EB1C51200D2200C /* util */ = {
 			isa = PBXGroup;
 			children = (
+				42056E7B1EB989AB0010597A /* KeyboardListener */,
 				71114AB91EB1C71E00D2200C /* zip */,
 				71114AA81EB1C5C000D2200C /* aes */,
 				71114AA41EB1C50D00D2200C /* RAUtils.h */,
@@ -348,6 +364,8 @@
 			children = (
 				71DCDC4F1EAF353000BA045A /* modelist.json */,
 				426E6B281EB8720400942BE1 /* Mode.storyboard */,
+				42056E851EB9CF5D0010597A /* BasicModeViewController.h */,
+				42056E861EB9CF5D0010597A /* BasicModeViewController.m */,
 				426E6B201EB85BD200942BE1 /* PopMode */,
 				426E6B211EB85BFC00942BE1 /* ModelMode */,
 			);
@@ -435,6 +453,7 @@
 				426E6B241EB85C2B00942BE1 /* PopModeViewController.m in Sources */,
 				71114AF01EB2DEF900D2200C /* RAMenu.m in Sources */,
 				71114AC61EB1C73B00D2200C /* ioapi.c in Sources */,
+				42056E7E1EB989AB0010597A /* JLKeyboardListener.m in Sources */,
 				71114AF11EB2DEF900D2200C /* ScannerControllerView.m in Sources */,
 				71114A9D1EB1BCB400D2200C /* LoginViewController.m in Sources */,
 				71114AB51EB1C5C800D2200C /* NSData+CommonCrypto.m in Sources */,
@@ -456,6 +475,7 @@
 				426E6B1F1EB8558400942BE1 /* RootModeCell.m in Sources */,
 				71DCDC391EAF234E00BA045A /* main.m in Sources */,
 				71114ABC1EB1C73400D2200C /* ZipArchive.mm in Sources */,
+				42056E871EB9CF5D0010597A /* BasicModeViewController.m in Sources */,
 				42E1B0FE1EB1C8EE00EEF27C /* LoginTextFiledCell.m in Sources */,
 				71114AB41EB1C5C800D2200C /* NSData+Base64.m in Sources */,
 				71114ACF1EB1C79300D2200C /* Reachability.m in Sources */,

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


+ 12 - 0
RA Image/RA Image/Base.lproj/Main.storyboard

@@ -131,6 +131,9 @@
                                                     <nil key="textColor"/>
                                                     <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                     <textInputTraits key="textInputTraits"/>
+                                                    <connections>
+                                                        <outlet property="delegate" destination="l61-Sy-3V2" id="XFr-3Q-Gtn"/>
+                                                    </connections>
                                                 </textField>
                                             </subviews>
                                             <constraints>
@@ -265,6 +268,9 @@
                                 <nil key="textColor"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                 <textInputTraits key="textInputTraits"/>
+                                <connections>
+                                    <outlet property="delegate" destination="r7u-Ls-Lza" id="J8f-Pz-Gwg"/>
+                                </connections>
                             </textField>
                             <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Name" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="N4g-tS-PSF">
                                 <rect key="frame" x="26" y="40" width="323" height="30"/>
@@ -274,6 +280,9 @@
                                 <nil key="textColor"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                 <textInputTraits key="textInputTraits"/>
+                                <connections>
+                                    <outlet property="delegate" destination="r7u-Ls-Lza" id="XKz-18-Ndz"/>
+                                </connections>
                             </textField>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Internal Address" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="l39-8d-pmH">
                                 <rect key="frame" x="86" y="80" width="279" height="40"/>
@@ -300,6 +309,9 @@
                                 <nil key="textColor"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                 <textInputTraits key="textInputTraits"/>
+                                <connections>
+                                    <outlet property="delegate" destination="r7u-Ls-Lza" id="Nzq-if-DkY"/>
+                                </connections>
                             </textField>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="External Address" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="65S-Fg-ERX">
                                 <rect key="frame" x="86" y="190" width="279" height="40"/>

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

@@ -0,0 +1,23 @@
+//
+//  BasicModeViewController.h
+//  RA Image
+//
+//  Created by Jack on 2017/5/3.
+//  Copyright © 2017年 USAI. All rights reserved.
+//
+
+#import "BasicViewController.h"
+
+@interface BasicModeViewController : BasicViewController<UINavigationControllerDelegate,UIImagePickerControllerDelegate>
+
+@property (nonatomic,copy) NSString *barcode;
+
+- (void)showScanner;
+- (void)clickCameraButton;
+- (void)showBarcodeInput;
+
+#pragma mark - 需要子类重写
+- (void)receiveImage:(UIImage *)img;
+- (void)receiveBarcode:(NSString *)code;
+
+@end

+ 166 - 0
RA Image/RA Image/BasicModeViewController.m

@@ -0,0 +1,166 @@
+//
+//  BasicModeViewController.m
+//  RA Image
+//
+//  Created by Jack on 2017/5/3.
+//  Copyright © 2017年 USAI. All rights reserved.
+//
+
+#import "BasicModeViewController.h"
+#import "ScannerViewController.h"
+
+@interface BasicModeViewController ()<UITextFieldDelegate>
+
+@end
+
+@implementation BasicModeViewController
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    // Do any additional setup after loading the view.
+}
+
+- (void)didReceiveMemoryWarning {
+    [super didReceiveMemoryWarning];
+    // Dispose of any resources that can be recreated.
+}
+
+- (void)showScanner {
+    __weak typeof(self) weakself = self;
+    ScannerViewController *scannerVC = [[UIStoryboard storyboardWithName:@"cam_scan" bundle:nil] instantiateViewControllerWithIdentifier:@"NewScannerViewController"];
+    scannerVC.returnCode = ^(NSString *code) {
+        // 扫描成功保存扫描值
+        if (code.length) {
+            
+            if (weakself) {
+                __strong typeof(weakself) strongself = weakself;
+                
+                [strongself receiveBarcode:code];
+            }
+            
+        }
+    };
+    [self presentViewController:scannerVC animated:YES completion:nil];
+}
+
+- (void)showCamera {
+    UIImagePickerController *imgPicker = [[UIImagePickerController alloc] init];
+    imgPicker.delegate = self;
+    //        AVAuthorizationStatus status = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
+    //        if (status != AVAuthorizationStatusAuthorized) {
+    //            // 未授权
+    //            [RAUtils message_alert:@"please allow app use camera" title:@"Warning" controller:weakself];
+    //        } else {
+    imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
+    imgPicker.allowsEditing = YES;
+    [self presentViewController:imgPicker animated:YES completion:nil];
+    
+    //        }
+}
+
+- (void)showPhotoLibrary {
+    
+    UIImagePickerController *imgPicker = [[UIImagePickerController alloc] init];
+    imgPicker.delegate = self;
+    //        ALAuthorizationStatus author = [ALAssetsLibrary authorizationStatus];
+    //        if (author != ALAuthorizationStatusAuthorized) {
+    //            [RAUtils message_alert:@"please allow app visit photo library" title:@"Warning" controller:weakself];
+    //        } else {
+    imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
+    imgPicker.allowsEditing = NO;
+    [self presentViewController:imgPicker animated:YES completion:nil];
+    //        }
+}
+
+- (void)showBarcodeInput {
+    __weak typeof(self) weakself = self;
+    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Please enter Barcode" message:nil preferredStyle:UIAlertControllerStyleAlert];
+    [alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
+       
+        textField.delegate = weakself;
+        
+    }];
+    
+    UIAlertAction *OK = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+
+    }];
+    
+    UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
+        
+    }];
+    
+    [alert addAction:cancel];
+    [alert addAction:OK];
+   
+    [self presentViewController:alert animated:YES completion:nil];
+    
+}
+
+- (void)receiveImage:(UIImage *)img {
+    
+}
+
+- (void)receiveBarcode:(NSString *)code {
+    
+}
+
+#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];
+}
+
+#pragma mark - Image Picker Delegate
+
+- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info
+{
+    UIImage *image = nil;
+    if (picker.sourceType == UIImagePickerControllerSourceTypeCamera) {
+        
+        image = [info objectForKey:UIImagePickerControllerEditedImage];
+        [picker dismissViewControllerAnimated:YES completion:nil];
+        
+    } else if (picker .sourceType == UIImagePickerControllerSourceTypePhotoLibrary) {
+        
+        image = [info objectForKey:UIImagePickerControllerOriginalImage];
+        [picker dismissViewControllerAnimated:YES completion:nil];
+    }
+    [self receiveImage:image];
+    
+}
+
+
+- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{
+    
+    [picker dismissViewControllerAnimated:YES completion:nil];
+    
+    
+}
+
+#pragma mark - TextField Delegate
+
+- (void)textFieldDidEndEditing:(UITextField *)textField {
+    self.barcode = textField.text;
+}
+
+@end

+ 39 - 0
RA Image/RA Image/KeyboardListener/JLKeyboardListener.h

@@ -0,0 +1,39 @@
+//
+//  JLKeyboardListener.h
+//  Keyboard
+//
+//  Created by Jack on 2017/4/11.
+//  Copyright © 2017年 buakaw. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@protocol JLKeyboardListenerDelegate <NSObject>
+
+@required
+- (void)keyboardWillShowHeight:(CGFloat)height withDuration:(NSTimeInterval)duration;
+
+- (void)keyboardWillHideHeight:(CGFloat)height withDuration:(NSTimeInterval)duration;
+
+/**
+ 键盘高度发生改变
+
+ @param height 新的键盘高度
+ @param heightOffset 发生改变偏移量,大于0表示高度增加
+ @param duration 动画持续时间
+ */
+- (void)keyboardWillChangeHeight:(CGFloat)height offset:(CGFloat)heightOffset withDuration:(NSTimeInterval)duration;
+
+@end
+
+@interface JLKeyboardListener : NSObject
+
+@property (nonatomic,weak) id<JLKeyboardListenerDelegate> delegate;
+
+@property (nonatomic,assign,readonly) CGFloat currentKeyboardHeight;
+
+- (void)startListen;
+
+- (void)stopListen;
+
+@end

+ 119 - 0
RA Image/RA Image/KeyboardListener/JLKeyboardListener.m

@@ -0,0 +1,119 @@
+//
+//  JLKeyboardListener.m
+//  Keyboard
+//
+//  Created by Jack on 2017/4/11.
+//  Copyright © 2017年 buakaw. All rights reserved.
+//
+
+#import "JLKeyboardListener.h"
+
+@interface JLKeyboardListener ()
+
+@property (nonatomic,assign) CGFloat keyboardHeight;
+@property (nonatomic,assign) NSTimeInterval keyboardAnimationDuration;
+@property (nonatomic,assign) BOOL showsKeyboard;
+
+@end
+
+@implementation JLKeyboardListener
+
+
+- (instancetype)init {
+    if (self = [super init]) {
+        self.showsKeyboard = NO;
+    }
+    return self;
+}
+
+- (void)dealloc {
+    [self stopListen];
+}
+
+- (void)startListen {
+    NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
+    // 键盘通知
+    [notificationCenter addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
+    [notificationCenter addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
+    [notificationCenter addObserver:self selector:@selector(keyboardChangeFrame:) name:UIKeyboardWillChangeFrameNotification object:nil];
+}
+
+- (void)stopListen {
+    NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
+    [notificationCenter removeObserver:self];
+}
+
+
+#pragma mark - keyboard Notification
+
+/**键盘隐藏*/
+- (void)keyboardWillHide:(NSNotification *)notification {
+    
+    if (self.showsKeyboard) {
+        self.showsKeyboard = NO;
+
+        if (self.delegate && [self.delegate respondsToSelector:@selector(keyboardWillHideHeight:withDuration:)]) {
+            [self.delegate keyboardWillHideHeight:self.keyboardHeight withDuration:self.keyboardAnimationDuration];
+        }
+    }
+}
+
+/**键盘显示*/
+- (void)keyboardWillShow:(NSNotification *)notification {
+    
+    NSTimeInterval duration = [[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue];
+    CGRect begin = [[[notification userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue];
+    CGRect end = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
+    
+    if (duration == 0) {
+        duration = 0.25;
+    }
+    self.keyboardAnimationDuration = duration;
+    if (!self.showsKeyboard) {
+        // 第三方键盘三次回调,仅执行最后一次(仅以搜狗输入法作的测试)
+        if (begin.size.height > 0 && begin.origin.y - end.origin.y > 0) {
+            
+            self.showsKeyboard = YES;
+            self.keyboardHeight = end.size.height;
+            if (self.delegate && [self.delegate respondsToSelector:@selector(keyboardWillShowHeight:withDuration:)]) {
+                [self.delegate keyboardWillShowHeight:self.keyboardHeight withDuration:self.keyboardAnimationDuration];
+            }
+            
+        }
+    }
+
+    
+}
+
+/**在使用过程中切换键盘*/
+- (void)keyboardChangeFrame:(NSNotification *)notification {
+    // 在屏幕旋转时也会走这个方法,但是此时键盘会 hide -> show -> changeFrame
+    if (self.showsKeyboard) {
+        CGRect begin = [[[notification userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue];
+        CGRect end = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
+        
+        // 在ip6s中使用搜狗输入法和系统键盘切换时发现
+        // sougou --> sys : 282 -> 258
+        // sys --> sougou : 258 -> 0 -> 216 -> 282 也就是说系统键盘先下去隐藏,再弹出搜狗,在弹出搜狗的过程中在216处有回调
+        
+        CGFloat offset = end.size.height - begin.size.height;
+        self.keyboardHeight = end.size.height;
+        
+        if (offset != 0) {
+            NSTimeInterval changeFrameAnimationDuartion = 0.25;
+            if (self.delegate && [self.delegate respondsToSelector:@selector(keyboardWillChangeHeight:offset:withDuration:)]) {
+                [self.delegate keyboardWillChangeHeight:self.keyboardHeight offset:offset withDuration:changeFrameAnimationDuartion];
+            }
+        }
+        
+        
+    }
+}
+
+#pragma mark - Getter
+
+- (CGFloat)currentKeyboardHeight {
+    return self.keyboardHeight;
+}
+
+@end

+ 18 - 1
RA Image/RA Image/LoginSettingViewController.m

@@ -11,7 +11,7 @@
 
 static NSString *kScanAddress = @"ScanAddress";
 
-@interface LoginSettingViewController ()
+@interface LoginSettingViewController ()<UITextFieldDelegate>
 
 @property (strong, nonatomic) IBOutlet UITextField *nameTextField;
 @property (strong, nonatomic) IBOutlet UIButton *internalCheckBtn;
@@ -34,8 +34,10 @@ static NSString *kScanAddress = @"ScanAddress";
     self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Scan" style:UIBarButtonItemStylePlain target:self action:@selector(scanItemClick:)];
     
     [self loadAddress];
+    [self registListenKeyboard];
 }
 
+
 - (void)didReceiveMemoryWarning {
     [super didReceiveMemoryWarning];
     // Dispose of any resources that can be recreated.
@@ -107,4 +109,19 @@ static NSString *kScanAddress = @"ScanAddress";
     if (sender.selected) self.internalCheckBtn.selected = NO;
 }
 
+#pragma mark - TextField Delegate
+
+
+- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
+    self.currentFirstResponder = textField;
+    return YES;
+}
+
+- (BOOL)textFieldShouldEndEditing:(UITextField *)textField {
+    return YES;
+}
+
+
+
+
 @end

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

@@ -14,7 +14,7 @@
 static NSString *kRememberLogin = @"RememberLogin";
 static NSString *kLoginUserInfo = @"UserInfo";
 
-@interface LoginViewController ()<UITableViewDelegate,UITableViewDataSource,LoginSwitchDelegate>
+@interface LoginViewController ()<UITableViewDelegate,UITableViewDataSource,LoginSwitchDelegate,UITextFieldDelegate>
 
 @property (strong, nonatomic) IBOutlet UITableView *loginTable;
 @property (nonatomic,strong) NSDictionary *dataDic;
@@ -24,6 +24,7 @@ static NSString *kLoginUserInfo = @"UserInfo";
 @property (nonatomic,copy) NSString *user;
 @property (nonatomic,copy) NSString *pwd;
 
+
 @end
 
 @implementation LoginViewController
@@ -35,8 +36,10 @@ static NSString *kLoginUserInfo = @"UserInfo";
     [self initUserData];
     [self loadData];
     [self.loginTable reloadData];
+    [self registListenKeyboard];
 }
 
+
 - (void)didReceiveMemoryWarning {
     [super didReceiveMemoryWarning];
     // Dispose of any resources that can be recreated.
@@ -86,13 +89,17 @@ static NSString *kLoginUserInfo = @"UserInfo";
 #pragma mark - Orientation
 
 - (BOOL)shouldAutorotate {
-    return NO;
+    return YES;
 }
 
 - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
     return UIInterfaceOrientationPortrait;
 }
 
+- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
+    return UIInterfaceOrientationMaskPortrait;
+}
+
 #pragma mark - DataSource
 
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
@@ -210,5 +217,17 @@ static NSString *kLoginUserInfo = @"UserInfo";
     
 }
 
+#pragma mark - TextField Delegate 
+
+- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
+    self.currentFirstResponder = textField;
+    return YES;
+}
+
+- (BOOL)textFieldShouldEndEditing:(UITextField *)textField {
+    self.currentFirstResponder = nil;
+    return YES;
+}
+
 
 @end

+ 493 - 19
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="retina4_7" orientation="portrait">
+    <device id="retina5_5" orientation="landscape">
         <adaptation id="fullscreen"/>
     </device>
     <dependencies>
@@ -21,23 +21,27 @@
                         <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="375" height="667"/>
+                        <rect key="frame" x="0.0" y="0.0" width="736" height="414"/>
                         <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="20" y="90" width="335" height="335"/>
+                                <rect key="frame" x="50" y="57" width="300" height="300"/>
                                 <color key="backgroundColor" red="1" green="0.36503490374616099" blue="0.7594767167726002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <constraints>
-                                    <constraint firstAttribute="height" constant="335" id="0HU-zi-itA"/>
+                                    <constraint firstAttribute="height" constant="280" id="0HU-zi-itA"/>
                                     <constraint firstAttribute="width" constant="200" id="CRQ-nA-AMT"/>
-                                    <constraint firstAttribute="width" constant="335" id="g7B-l2-sh1"/>
+                                    <constraint firstAttribute="height" constant="300" id="MeS-xa-i8C"/>
+                                    <constraint firstAttribute="width" constant="280" id="g7B-l2-sh1"/>
+                                    <constraint firstAttribute="width" constant="300" id="iEY-E3-pLn"/>
                                     <constraint firstAttribute="height" constant="200" id="jht-Cb-s48"/>
                                 </constraints>
                                 <variation key="default">
                                     <mask key="constraints">
                                         <exclude reference="0HU-zi-itA"/>
                                         <exclude reference="CRQ-nA-AMT"/>
+                                        <exclude reference="MeS-xa-i8C"/>
                                         <exclude reference="g7B-l2-sh1"/>
+                                        <exclude reference="iEY-E3-pLn"/>
                                         <exclude reference="jht-Cb-s48"/>
                                     </mask>
                                 </variation>
@@ -47,6 +51,12 @@
                                         <include reference="jht-Cb-s48"/>
                                     </mask>
                                 </variation>
+                                <variation key="heightClass=compact-widthClass=regular">
+                                    <mask key="constraints">
+                                        <include reference="MeS-xa-i8C"/>
+                                        <include reference="iEY-E3-pLn"/>
+                                    </mask>
+                                </variation>
                                 <variation key="heightClass=regular-widthClass=compact">
                                     <mask key="constraints">
                                         <include reference="0HU-zi-itA"/>
@@ -55,9 +65,12 @@
                                         <exclude reference="jht-Cb-s48"/>
                                     </mask>
                                 </variation>
+                                <connections>
+                                    <action selector="imgBtnClick:" destination="K9i-vs-efO" eventType="touchUpInside" id="0xC-AA-qah"/>
+                                </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="20" y="560" width="60" height="60"/>
+                                <rect key="frame" x="380" y="297" width="54" 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"/>
@@ -83,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="157" y="560" width="60" height="60"/>
+                                <rect key="frame" x="521" y="297" width="54" 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"/>
@@ -94,54 +107,86 @@
                                 </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="20" y="454" width="335" height="21"/>
+                                <rect key="frame" x="380" y="57" width="336" 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="295" y="560" width="60" height="60"/>
+                                <rect key="frame" x="662" y="297" width="54" 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>
                                     <action selector="uploadBtnClick:" destination="K9i-vs-efO" eventType="touchUpInside" id="raC-cp-9OQ"/>
                                 </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"/>
+                                <constraints>
+                                    <constraint firstAttribute="width" constant="30" id="ART-XN-Nuf"/>
+                                </constraints>
+                                <fontDescription key="fontDescription" type="system" pointSize="12"/>
+                                <state key="normal" title="Type">
+                                    <color key="titleColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
+                                </state>
+                                <connections>
+                                    <action selector="typeBtnClick:" destination="K9i-vs-efO" eventType="touchUpInside" id="NoL-VF-6k9"/>
+                                </connections>
+                            </button>
                         </subviews>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                         <constraints>
                             <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="70" id="5rw-rk-Rgm"/>
-                            <constraint firstItem="NAz-nK-Hgz" firstAttribute="leading" secondItem="6jr-Xw-2tL" secondAttribute="trailing" constant="50" id="6V1-Ef-pvP"/>
+                            <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="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"/>
                             <constraint firstItem="7rM-i2-eHr" firstAttribute="leading" secondItem="6jr-Xw-2tL" secondAttribute="leading" id="Ga1-pH-f1Y"/>
                             <constraint firstItem="NAz-nK-Hgz" firstAttribute="width" secondItem="6jr-Xw-2tL" secondAttribute="width" id="Hu1-eO-C70"/>
                             <constraint firstItem="NAz-nK-Hgz" firstAttribute="bottom" secondItem="6jr-Xw-2tL" secondAttribute="bottom" id="IEC-xA-RER"/>
+                            <constraint firstItem="6jr-Xw-2tL" firstAttribute="bottom" secondItem="tx6-Jq-V78" secondAttribute="bottom" id="ITb-vM-nLr"/>
                             <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="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"/>
-                            <constraint firstItem="6jr-Xw-2tL" firstAttribute="leading" secondItem="tx6-Jq-V78" secondAttribute="trailing" constant="60" id="PaT-5f-5BR"/>
-                            <constraint firstItem="tx6-Jq-V78" firstAttribute="top" secondItem="dcO-dt-BeO" secondAttribute="bottom" constant="70" id="Q50-Zd-pg5"/>
+                            <constraint firstItem="jte-R6-noU" firstAttribute="trailing" secondItem="7rM-i2-eHr" secondAttribute="trailing" id="PWK-eA-gMJ"/>
+                            <constraint firstItem="6jr-Xw-2tL" firstAttribute="leading" secondItem="tx6-Jq-V78" secondAttribute="trailing" constant="30" id="PaT-5f-5BR"/>
+                            <constraint firstItem="tx6-Jq-V78" firstAttribute="top" secondItem="dcO-dt-BeO" secondAttribute="bottom" constant="30" id="Q50-Zd-pg5"/>
                             <constraint firstItem="tx6-Jq-V78" firstAttribute="leading" secondItem="QEg-TT-jt8" secondAttribute="leadingMargin" constant="30" id="T4x-ql-gYS"/>
                             <constraint firstItem="8eX-wZ-j58" firstAttribute="top" secondItem="NAz-nK-Hgz" secondAttribute="bottom" constant="47" id="UFG-NX-fXs"/>
-                            <constraint firstItem="jte-R6-noU" firstAttribute="leading" secondItem="NAz-nK-Hgz" secondAttribute="trailing" constant="50" id="X0n-8i-crf"/>
+                            <constraint firstItem="jte-R6-noU" firstAttribute="bottom" secondItem="NAz-nK-Hgz" secondAttribute="bottom" id="VPW-J1-8kq"/>
+                            <constraint firstItem="Rvg-OG-bQ0" firstAttribute="top" secondItem="7rM-i2-eHr" secondAttribute="top" id="Ylg-57-RDu"/>
                             <constraint firstItem="jte-R6-noU" firstAttribute="trailing" secondItem="tx6-Jq-V78" secondAttribute="trailing" id="aEa-b6-mFx"/>
                             <constraint firstAttribute="trailingMargin" secondItem="7rM-i2-eHr" secondAttribute="trailing" id="aWv-n7-eAS"/>
                             <constraint firstItem="jte-R6-noU" firstAttribute="bottom" secondItem="NAz-nK-Hgz" secondAttribute="bottom" id="bYg-yw-F3b"/>
                             <constraint firstItem="6jr-Xw-2tL" firstAttribute="leading" secondItem="7rM-i2-eHr" secondAttribute="leading" id="dXd-PM-PHl"/>
+                            <constraint firstItem="tx6-Jq-V78" firstAttribute="leading" secondItem="QEg-TT-jt8" secondAttribute="leadingMargin" constant="30" id="eV0-Zt-LcB"/>
+                            <constraint firstItem="6jr-Xw-2tL" firstAttribute="leading" secondItem="7rM-i2-eHr" secondAttribute="leading" id="ejJ-HD-mRh"/>
                             <constraint firstItem="jte-R6-noU" firstAttribute="height" secondItem="NAz-nK-Hgz" secondAttribute="height" id="fPr-5K-jIw"/>
                             <constraint firstItem="NAz-nK-Hgz" firstAttribute="centerX" secondItem="QEg-TT-jt8" secondAttribute="centerX" id="fWf-CG-Oxq"/>
                             <constraint firstItem="6jr-Xw-2tL" firstAttribute="bottom" secondItem="tx6-Jq-V78" secondAttribute="bottom" id="gKZ-Rf-rrp"/>
                             <constraint firstItem="NAz-nK-Hgz" firstAttribute="baseline" secondItem="jte-R6-noU" secondAttribute="baseline" id="iGI-ja-RL9"/>
+                            <constraint firstItem="Rvg-OG-bQ0" firstAttribute="height" secondItem="7rM-i2-eHr" secondAttribute="height" id="jMh-DV-dix"/>
                             <constraint firstItem="NAz-nK-Hgz" firstAttribute="baseline" secondItem="6jr-Xw-2tL" secondAttribute="firstBaseline" id="jQL-1o-us5"/>
+                            <constraint firstItem="jte-R6-noU" firstAttribute="width" secondItem="NAz-nK-Hgz" secondAttribute="width" id="mIV-7G-bzr"/>
                             <constraint firstItem="NAz-nK-Hgz" firstAttribute="width" secondItem="6jr-Xw-2tL" secondAttribute="width" id="nDa-Fe-yJJ"/>
+                            <constraint firstItem="jte-R6-noU" firstAttribute="height" secondItem="NAz-nK-Hgz" secondAttribute="height" id="oYB-P2-H5S"/>
                             <constraint firstItem="NAz-nK-Hgz" firstAttribute="firstBaseline" secondItem="6jr-Xw-2tL" secondAttribute="baseline" id="pNG-k3-IPR"/>
+                            <constraint firstItem="7rM-i2-eHr" firstAttribute="leading" secondItem="tx6-Jq-V78" secondAttribute="trailing" constant="30" id="rZO-Cu-PjR"/>
                             <constraint firstItem="7rM-i2-eHr" firstAttribute="top" secondItem="tx6-Jq-V78" secondAttribute="top" id="sxc-Kf-lRS"/>
+                            <constraint firstItem="7rM-i2-eHr" firstAttribute="top" secondItem="tx6-Jq-V78" secondAttribute="top" id="wjm-RD-ue6"/>
                             <constraint firstItem="jte-R6-noU" firstAttribute="width" secondItem="NAz-nK-Hgz" secondAttribute="width" id="xNj-Z3-CKd"/>
                             <constraint firstItem="tx6-Jq-V78" firstAttribute="centerX" secondItem="QEg-TT-jt8" secondAttribute="centerX" id="xWS-0a-saS"/>
+                            <constraint firstItem="6jr-Xw-2tL" firstAttribute="height" secondItem="NAz-nK-Hgz" secondAttribute="height" id="xdP-ja-Wyx"/>
+                            <constraint firstItem="tx6-Jq-V78" firstAttribute="centerY" secondItem="QEg-TT-jt8" secondAttribute="centerY" id="yNd-fe-ig4"/>
                             <constraint firstItem="NAz-nK-Hgz" firstAttribute="height" secondItem="6jr-Xw-2tL" secondAttribute="height" id="zU9-uo-KR5"/>
+                            <constraint firstItem="Rvg-OG-bQ0" firstAttribute="leading" secondItem="7rM-i2-eHr" secondAttribute="trailing" constant="-30" id="zgs-fx-AAf"/>
                         </constraints>
                         <variation key="default">
                             <mask key="constraints">
@@ -149,20 +194,31 @@
                                 <exclude reference="PVr-4c-8If"/>
                                 <exclude reference="Q50-Zd-pg5"/>
                                 <exclude reference="T4x-ql-gYS"/>
+                                <exclude reference="eV0-Zt-LcB"/>
                                 <exclude reference="xWS-0a-saS"/>
+                                <exclude reference="yNd-fe-ig4"/>
                                 <exclude reference="5oU-RN-aAR"/>
+                                <exclude reference="AnY-BM-aep"/>
                                 <exclude reference="Ga1-pH-f1Y"/>
                                 <exclude reference="IkZ-kb-uSH"/>
                                 <exclude reference="KLA-9l-yX3"/>
                                 <exclude reference="aWv-n7-eAS"/>
+                                <exclude reference="rZO-Cu-PjR"/>
                                 <exclude reference="sxc-Kf-lRS"/>
+                                <exclude reference="wjm-RD-ue6"/>
+                                <exclude reference="ITb-vM-nLr"/>
+                                <exclude reference="OGr-rO-amZ"/>
                                 <exclude reference="PaT-5f-5BR"/>
                                 <exclude reference="dXd-PM-PHl"/>
+                                <exclude reference="ejJ-HD-mRh"/>
                                 <exclude reference="gKZ-Rf-rrp"/>
-                                <exclude reference="6V1-Ef-pvP"/>
+                                <exclude reference="xdP-ja-Wyx"/>
                                 <exclude reference="Azo-Ej-bva"/>
+                                <exclude reference="DbX-Yw-N8R"/>
+                                <exclude reference="E5d-E1-Uxn"/>
                                 <exclude reference="Hu1-eO-C70"/>
                                 <exclude reference="IEC-xA-RER"/>
+                                <exclude reference="PH0-8k-I6I"/>
                                 <exclude reference="fWf-CG-Oxq"/>
                                 <exclude reference="iGI-ja-RL9"/>
                                 <exclude reference="jQL-1o-us5"/>
@@ -170,11 +226,15 @@
                                 <exclude reference="pNG-k3-IPR"/>
                                 <exclude reference="zU9-uo-KR5"/>
                                 <exclude reference="Cz1-jn-gUG"/>
+                                <exclude reference="F9a-4T-n2t"/>
                                 <exclude reference="G9A-SK-NbZ"/>
-                                <exclude reference="X0n-8i-crf"/>
+                                <exclude reference="PWK-eA-gMJ"/>
+                                <exclude reference="VPW-J1-8kq"/>
                                 <exclude reference="aEa-b6-mFx"/>
                                 <exclude reference="bYg-yw-F3b"/>
                                 <exclude reference="fPr-5K-jIw"/>
+                                <exclude reference="mIV-7G-bzr"/>
+                                <exclude reference="oYB-P2-H5S"/>
                                 <exclude reference="xNj-Z3-CKd"/>
                                 <exclude reference="UFG-NX-fXs"/>
                             </mask>
@@ -188,16 +248,35 @@
                                 <include reference="sxc-Kf-lRS"/>
                                 <include reference="PaT-5f-5BR"/>
                                 <include reference="gKZ-Rf-rrp"/>
-                                <include reference="6V1-Ef-pvP"/>
+                                <include reference="E5d-E1-Uxn"/>
                                 <include reference="Hu1-eO-C70"/>
                                 <include reference="IEC-xA-RER"/>
                                 <include reference="zU9-uo-KR5"/>
                                 <include reference="Cz1-jn-gUG"/>
+                                <include reference="F9a-4T-n2t"/>
                                 <include reference="G9A-SK-NbZ"/>
-                                <include reference="X0n-8i-crf"/>
                                 <include reference="bYg-yw-F3b"/>
                             </mask>
                         </variation>
+                        <variation key="heightClass=compact-widthClass=regular">
+                            <mask key="constraints">
+                                <include reference="eV0-Zt-LcB"/>
+                                <include reference="yNd-fe-ig4"/>
+                                <include reference="AnY-BM-aep"/>
+                                <include reference="rZO-Cu-PjR"/>
+                                <include reference="wjm-RD-ue6"/>
+                                <include reference="ITb-vM-nLr"/>
+                                <include reference="OGr-rO-amZ"/>
+                                <include reference="ejJ-HD-mRh"/>
+                                <include reference="xdP-ja-Wyx"/>
+                                <include reference="DbX-Yw-N8R"/>
+                                <include reference="PH0-8k-I6I"/>
+                                <include reference="PWK-eA-gMJ"/>
+                                <include reference="VPW-J1-8kq"/>
+                                <include reference="mIV-7G-bzr"/>
+                                <include reference="oYB-P2-H5S"/>
+                            </mask>
+                        </variation>
                         <variation key="heightClass=regular-widthClass=compact">
                             <mask key="constraints">
                                 <include reference="5rw-rk-Rgm"/>
@@ -225,12 +304,407 @@
                         <outlet property="camerBtn" destination="NAz-nK-Hgz" id="5L3-aN-Dtb"/>
                         <outlet property="imgBtn" destination="tx6-Jq-V78" id="xle-Dc-8GI"/>
                         <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"/>
                     </connections>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="GQR-ak-uz6" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
-            <point key="canvasLocation" x="-250.40000000000001" y="105.69715142428787"/>
+            <point key="canvasLocation" x="-251.08695652173915" y="104.34782608695653"/>
+        </scene>
+        <!--Model Mode View Controller-->
+        <scene sceneID="ECb-ak-l9W">
+            <objects>
+                <viewController storyboardIdentifier="ModelModeViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="7Iz-ry-1hB" customClass="ModelModeViewController" sceneMemberID="viewController">
+                    <layoutGuides>
+                        <viewControllerLayoutGuide type="top" id="4Aa-BZ-4nb"/>
+                        <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"/>
+                        <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"/>
+                                <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"/>
+                                    <constraint firstAttribute="width" constant="300" id="RlC-zy-TdJ"/>
+                                    <constraint firstAttribute="height" constant="300" id="UMs-Q1-i7w"/>
+                                    <constraint firstAttribute="width" constant="280" id="XIa-j5-AGR"/>
+                                    <constraint firstAttribute="height" constant="280" id="jyS-DL-baZ"/>
+                                    <constraint firstAttribute="width" constant="200" id="mCl-LY-zev"/>
+                                </constraints>
+                                <variation key="default">
+                                    <mask key="constraints">
+                                        <exclude reference="jyS-DL-baZ"/>
+                                        <exclude reference="mCl-LY-zev"/>
+                                        <exclude reference="UMs-Q1-i7w"/>
+                                        <exclude reference="XIa-j5-AGR"/>
+                                        <exclude reference="RlC-zy-TdJ"/>
+                                        <exclude reference="P4F-3c-O90"/>
+                                    </mask>
+                                </variation>
+                                <variation key="heightClass=compact-widthClass=compact">
+                                    <mask key="constraints">
+                                        <include reference="mCl-LY-zev"/>
+                                        <include reference="P4F-3c-O90"/>
+                                    </mask>
+                                </variation>
+                                <variation key="heightClass=compact-widthClass=regular">
+                                    <mask key="constraints">
+                                        <include reference="UMs-Q1-i7w"/>
+                                        <include reference="RlC-zy-TdJ"/>
+                                    </mask>
+                                </variation>
+                                <variation key="heightClass=regular-widthClass=compact">
+                                    <mask key="constraints">
+                                        <include reference="jyS-DL-baZ"/>
+                                        <exclude reference="mCl-LY-zev"/>
+                                        <include reference="XIa-j5-AGR"/>
+                                        <exclude reference="P4F-3c-O90"/>
+                                    </mask>
+                                </variation>
+                                <connections>
+                                    <action selector="imgBtnClick:" destination="7Iz-ry-1hB" eventType="touchUpInside" id="GBm-oz-mfv"/>
+                                </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"/>
+                                <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"/>
+                                </constraints>
+                                <state key="normal" title="Scan"/>
+                                <variation key="default">
+                                    <mask key="constraints">
+                                        <exclude reference="qWl-ce-tQ1"/>
+                                    </mask>
+                                </variation>
+                                <variation key="heightClass=compact-widthClass=compact">
+                                    <mask key="constraints">
+                                        <include reference="qWl-ce-tQ1"/>
+                                    </mask>
+                                </variation>
+                                <variation key="heightClass=regular-widthClass=compact">
+                                    <mask key="constraints">
+                                        <include reference="qWl-ce-tQ1"/>
+                                    </mask>
+                                </variation>
+                                <connections>
+                                    <action selector="scanBtnClick:" destination="7Iz-ry-1hB" eventType="touchUpInside" id="Oeb-HU-8hn"/>
+                                </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"/>
+                                <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"/>
+                                </constraints>
+                                <state key="normal" title="Camera"/>
+                                <connections>
+                                    <action selector="cameraBtnClick:" destination="7Iz-ry-1hB" eventType="touchUpInside" id="oYV-I4-zg3"/>
+                                </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"/>
+                                <color key="backgroundColor" red="0.25435081980000002" green="0.75957768849999996" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                <state key="normal" title="Upload"/>
+                                <connections>
+                                    <action selector="uploadBtnClick:" destination="7Iz-ry-1hB" eventType="touchUpInside" id="Iqc-0G-ztp"/>
+                                </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"/>
+                                <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"/>
+                                <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" width="346" height="184"/>
+                                <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
+                                <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                                <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
+                                <connections>
+                                    <outlet property="delegate" destination="7Iz-ry-1hB" id="58N-3N-522"/>
+                                </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"/>
+                                <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"/>
+                                <constraints>
+                                    <constraint firstAttribute="width" constant="30" id="gjf-JE-DIU"/>
+                                </constraints>
+                                <fontDescription key="fontDescription" type="system" pointSize="12"/>
+                                <state key="normal" title="Type">
+                                    <color key="titleColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
+                                </state>
+                                <connections>
+                                    <action selector="typeBtnClick:" destination="7Iz-ry-1hB" eventType="touchUpInside" id="7gC-wE-byx"/>
+                                </connections>
+                            </button>
+                        </subviews>
+                        <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                        <constraints>
+                            <constraint firstItem="ZS1-pc-kXu" firstAttribute="top" secondItem="RZK-hh-toU" secondAttribute="bottom" constant="19" id="02G-Zl-PJ1"/>
+                            <constraint firstItem="951-qi-5kI" firstAttribute="bottom" secondItem="8cw-MJ-Ahc" secondAttribute="bottom" id="0l7-5q-3zf"/>
+                            <constraint firstItem="RZK-hh-toU" firstAttribute="leading" secondItem="i3W-S0-nip" secondAttribute="leading" id="1S0-UD-XmD"/>
+                            <constraint firstItem="xAA-t1-vMd" firstAttribute="width" secondItem="951-qi-5kI" secondAttribute="width" id="1To-SE-ubO"/>
+                            <constraint firstAttribute="trailingMargin" secondItem="RZK-hh-toU" secondAttribute="trailing" id="2Hh-7b-Cr1"/>
+                            <constraint firstItem="gY5-Tk-ev9" firstAttribute="width" secondItem="i3W-S0-nip" secondAttribute="width" id="3Xa-0l-Yfs"/>
+                            <constraint firstItem="ZS1-pc-kXu" firstAttribute="width" secondItem="RZK-hh-toU" secondAttribute="width" id="3Zf-6r-xDu"/>
+                            <constraint firstItem="H4g-H8-jhv" firstAttribute="top" secondItem="i3W-S0-nip" secondAttribute="bottom" constant="30" id="5QC-IL-i1w"/>
+                            <constraint firstItem="8cw-MJ-Ahc" firstAttribute="bottom" secondItem="i3W-S0-nip" secondAttribute="bottom" id="6Uu-lh-pOC"/>
+                            <constraint firstItem="951-qi-5kI" firstAttribute="width" secondItem="8cw-MJ-Ahc" secondAttribute="width" id="7GX-rm-Lu7"/>
+                            <constraint firstItem="ZS1-pc-kXu" firstAttribute="top" secondItem="RZK-hh-toU" secondAttribute="bottom" constant="9" id="7bo-hf-pL8"/>
+                            <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="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"/>
+                            <constraint firstItem="A3O-9b-0D7" firstAttribute="leading" secondItem="RZK-hh-toU" secondAttribute="trailing" constant="-30" id="FhU-3d-s2R"/>
+                            <constraint firstItem="xAA-t1-vMd" firstAttribute="height" secondItem="951-qi-5kI" secondAttribute="height" id="Hru-49-ooh"/>
+                            <constraint firstItem="ZS1-pc-kXu" firstAttribute="leading" secondItem="RZK-hh-toU" secondAttribute="leading" id="IDZ-q7-DAM"/>
+                            <constraint firstItem="951-qi-5kI" firstAttribute="bottom" secondItem="8cw-MJ-Ahc" secondAttribute="bottom" id="IP5-P6-wmP"/>
+                            <constraint firstItem="A3O-9b-0D7" firstAttribute="centerY" secondItem="RZK-hh-toU" secondAttribute="centerY" id="JhH-ed-LhG"/>
+                            <constraint firstItem="gY5-Tk-ev9" firstAttribute="leading" secondItem="i3W-S0-nip" secondAttribute="leading" id="K9I-2J-kAA"/>
+                            <constraint firstItem="i3W-S0-nip" firstAttribute="centerY" secondItem="o96-bU-q7q" secondAttribute="centerY" id="Lc8-bZ-SAh"/>
+                            <constraint firstItem="i3W-S0-nip" firstAttribute="leading" secondItem="o96-bU-q7q" secondAttribute="leadingMargin" constant="30" id="MQm-vi-n8A"/>
+                            <constraint firstItem="xAA-t1-vMd" firstAttribute="bottom" secondItem="951-qi-5kI" secondAttribute="bottom" id="Med-B3-2rc"/>
+                            <constraint firstItem="8cw-MJ-Ahc" firstAttribute="leading" secondItem="RZK-hh-toU" secondAttribute="leading" id="PFl-di-byG"/>
+                            <constraint firstItem="8cw-MJ-Ahc" firstAttribute="width" secondItem="951-qi-5kI" secondAttribute="width" id="PKZ-co-q6C"/>
+                            <constraint firstItem="i3W-S0-nip" firstAttribute="top" secondItem="gY5-Tk-ev9" secondAttribute="bottom" constant="5" id="Pvi-Wv-s7Q"/>
+                            <constraint firstItem="ZS1-pc-kXu" firstAttribute="leading" secondItem="RZK-hh-toU" secondAttribute="leading" id="Q7L-Cg-Rml"/>
+                            <constraint firstItem="xAA-t1-vMd" firstAttribute="trailing" secondItem="RZK-hh-toU" secondAttribute="trailing" id="RFB-IF-30T"/>
+                            <constraint firstItem="8cw-MJ-Ahc" firstAttribute="height" secondItem="951-qi-5kI" secondAttribute="height" id="RPz-TG-EgB"/>
+                            <constraint firstItem="ZS1-pc-kXu" firstAttribute="centerX" secondItem="RZK-hh-toU" secondAttribute="centerX" id="Rv6-Vd-AU0"/>
+                            <constraint firstItem="xAA-t1-vMd" firstAttribute="bottom" secondItem="951-qi-5kI" secondAttribute="bottom" id="T4E-f3-xNP"/>
+                            <constraint firstItem="A3O-9b-0D7" firstAttribute="top" secondItem="RZK-hh-toU" secondAttribute="top" id="UPN-HB-L7I"/>
+                            <constraint firstItem="ZS1-pc-kXu" firstAttribute="width" secondItem="gY5-Tk-ev9" secondAttribute="width" id="VVS-oN-KzO"/>
+                            <constraint firstItem="951-qi-5kI" firstAttribute="width" secondItem="8cw-MJ-Ahc" secondAttribute="width" id="Wi0-HE-j74"/>
+                            <constraint firstItem="951-qi-5kI" firstAttribute="centerX" secondItem="o96-bU-q7q" secondAttribute="centerX" id="XMG-Nj-hPo"/>
+                            <constraint firstItem="gY5-Tk-ev9" firstAttribute="width" secondItem="i3W-S0-nip" secondAttribute="width" id="XPd-Dh-N8o"/>
+                            <constraint firstItem="RZK-hh-toU" firstAttribute="top" secondItem="i3W-S0-nip" secondAttribute="top" id="Yfo-47-OeF"/>
+                            <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="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"/>
+                            <constraint firstItem="ZS1-pc-kXu" firstAttribute="bottom" secondItem="951-qi-5kI" secondAttribute="top" constant="-10" id="ecu-ka-7Kw"/>
+                            <constraint firstItem="i3W-S0-nip" firstAttribute="top" secondItem="gY5-Tk-ev9" secondAttribute="bottom" constant="5" id="fKq-KT-Btl"/>
+                            <constraint firstItem="RZK-hh-toU" firstAttribute="width" secondItem="i3W-S0-nip" secondAttribute="width" id="fRg-I4-wzf"/>
+                            <constraint firstItem="ZS1-pc-kXu" firstAttribute="leading" secondItem="RZK-hh-toU" secondAttribute="leading" id="gUk-GU-v1u"/>
+                            <constraint firstItem="8cw-MJ-Ahc" firstAttribute="leading" secondItem="i3W-S0-nip" secondAttribute="trailing" constant="30" id="h3X-Sv-4VE"/>
+                            <constraint firstItem="951-qi-5kI" firstAttribute="centerX" secondItem="RZK-hh-toU" secondAttribute="centerX" id="hCA-0z-Z6u"/>
+                            <constraint firstItem="RZK-hh-toU" firstAttribute="top" secondItem="i3W-S0-nip" secondAttribute="bottom" constant="10" id="hNg-h6-9D6"/>
+                            <constraint firstItem="ZS1-pc-kXu" firstAttribute="width" secondItem="RZK-hh-toU" secondAttribute="width" id="hbN-Zu-Pll"/>
+                            <constraint firstItem="951-qi-5kI" firstAttribute="baseline" secondItem="xAA-t1-vMd" secondAttribute="baseline" id="lgt-jy-gsD"/>
+                            <constraint firstItem="xAA-t1-vMd" firstAttribute="width" secondItem="951-qi-5kI" secondAttribute="width" id="lpK-C1-TrF"/>
+                            <constraint firstItem="xAA-t1-vMd" firstAttribute="width" secondItem="951-qi-5kI" secondAttribute="width" id="mG3-eu-q03"/>
+                            <constraint firstItem="951-qi-5kI" firstAttribute="centerX" secondItem="RZK-hh-toU" secondAttribute="centerX" id="mP3-Aw-Eg2"/>
+                            <constraint firstItem="i3W-S0-nip" firstAttribute="top" secondItem="4Aa-BZ-4nb" secondAttribute="bottom" constant="50" id="oUd-Hv-bEF"/>
+                            <constraint firstItem="xAA-t1-vMd" firstAttribute="trailing" secondItem="RZK-hh-toU" secondAttribute="trailing" id="obK-KN-Wre"/>
+                            <constraint firstItem="951-qi-5kI" firstAttribute="height" secondItem="8cw-MJ-Ahc" secondAttribute="height" id="pTh-mC-e27"/>
+                            <constraint firstItem="A3O-9b-0D7" firstAttribute="height" secondItem="RZK-hh-toU" secondAttribute="height" id="qwy-hz-W4h"/>
+                            <constraint firstItem="RZK-hh-toU" firstAttribute="leading" secondItem="i3W-S0-nip" secondAttribute="trailing" constant="20" id="rco-TJ-C6H"/>
+                            <constraint firstItem="H4g-H8-jhv" firstAttribute="top" secondItem="951-qi-5kI" secondAttribute="bottom" constant="47" id="rgN-nI-NeD"/>
+                            <constraint firstAttribute="trailingMargin" secondItem="RZK-hh-toU" secondAttribute="trailing" id="ruP-WY-u3Q"/>
+                            <constraint firstItem="ZS1-pc-kXu" firstAttribute="width" secondItem="RZK-hh-toU" secondAttribute="width" id="sMx-RK-bdo"/>
+                            <constraint firstItem="951-qi-5kI" firstAttribute="top" secondItem="8cw-MJ-Ahc" secondAttribute="top" id="sli-1k-i5W"/>
+                            <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="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"/>
+                            <constraint firstItem="xAA-t1-vMd" firstAttribute="trailing" secondItem="i3W-S0-nip" secondAttribute="trailing" id="xbY-aK-MNO"/>
+                            <constraint firstItem="951-qi-5kI" firstAttribute="top" secondItem="ZS1-pc-kXu" secondAttribute="bottom" constant="20" id="xdL-hU-8Np"/>
+                        </constraints>
+                        <variation key="default">
+                            <mask key="constraints">
+                                <exclude reference="3Xa-0l-Yfs"/>
+                                <exclude reference="7x0-YS-4WJ"/>
+                                <exclude reference="K9I-2J-kAA"/>
+                                <exclude reference="XPd-Dh-N8o"/>
+                                <exclude reference="b1h-sL-21M"/>
+                                <exclude reference="cAf-h5-l3V"/>
+                                <exclude reference="Bdg-Gf-Ion"/>
+                                <exclude reference="Cyd-MP-wCx"/>
+                                <exclude reference="Lc8-bZ-SAh"/>
+                                <exclude reference="MQm-vi-n8A"/>
+                                <exclude reference="Pvi-Wv-s7Q"/>
+                                <exclude reference="dZe-Lr-jbB"/>
+                                <exclude reference="fKq-KT-Btl"/>
+                                <exclude reference="oUd-Hv-bEF"/>
+                                <exclude reference="w45-Qc-74D"/>
+                                <exclude reference="1S0-UD-XmD"/>
+                                <exclude reference="2Hh-7b-Cr1"/>
+                                <exclude reference="B3m-FM-7Wx"/>
+                                <exclude reference="Yfo-47-OeF"/>
+                                <exclude reference="fRg-I4-wzf"/>
+                                <exclude reference="hNg-h6-9D6"/>
+                                <exclude reference="rco-TJ-C6H"/>
+                                <exclude reference="ruP-WY-u3Q"/>
+                                <exclude reference="tjD-kp-s3D"/>
+                                <exclude reference="02G-Zl-PJ1"/>
+                                <exclude reference="3Zf-6r-xDu"/>
+                                <exclude reference="7bo-hf-pL8"/>
+                                <exclude reference="IDZ-q7-DAM"/>
+                                <exclude reference="Q7L-Cg-Rml"/>
+                                <exclude reference="Rv6-Vd-AU0"/>
+                                <exclude reference="VVS-oN-KzO"/>
+                                <exclude reference="b5u-Xv-NO9"/>
+                                <exclude reference="ecu-ka-7Kw"/>
+                                <exclude reference="gUk-GU-v1u"/>
+                                <exclude reference="hbN-Zu-Pll"/>
+                                <exclude reference="sMx-RK-bdo"/>
+                                <exclude reference="6Uu-lh-pOC"/>
+                                <exclude reference="DDb-NZ-fPw"/>
+                                <exclude reference="PFl-di-byG"/>
+                                <exclude reference="PKZ-co-q6C"/>
+                                <exclude reference="RPz-TG-EgB"/>
+                                <exclude reference="h3X-Sv-4VE"/>
+                                <exclude reference="vZx-LD-eJX"/>
+                                <exclude reference="0l7-5q-3zf"/>
+                                <exclude reference="7GX-rm-Lu7"/>
+                                <exclude reference="IP5-P6-wmP"/>
+                                <exclude reference="Wi0-HE-j74"/>
+                                <exclude reference="XMG-Nj-hPo"/>
+                                <exclude reference="hCA-0z-Z6u"/>
+                                <exclude reference="lgt-jy-gsD"/>
+                                <exclude reference="mP3-Aw-Eg2"/>
+                                <exclude reference="pTh-mC-e27"/>
+                                <exclude reference="sli-1k-i5W"/>
+                                <exclude reference="ukF-93-xfZ"/>
+                                <exclude reference="vkf-vf-2IX"/>
+                                <exclude reference="waZ-2w-RW1"/>
+                                <exclude reference="xdL-hU-8Np"/>
+                                <exclude reference="1To-SE-ubO"/>
+                                <exclude reference="Fdp-ve-rXy"/>
+                                <exclude reference="Hru-49-ooh"/>
+                                <exclude reference="Med-B3-2rc"/>
+                                <exclude reference="RFB-IF-30T"/>
+                                <exclude reference="T4E-f3-xNP"/>
+                                <exclude reference="bLt-dG-GN6"/>
+                                <exclude reference="dN1-g3-Mda"/>
+                                <exclude reference="lpK-C1-TrF"/>
+                                <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">
+                            <mask key="constraints">
+                                <include reference="K9I-2J-kAA"/>
+                                <include reference="b1h-sL-21M"/>
+                                <include reference="Lc8-bZ-SAh"/>
+                                <include reference="MQm-vi-n8A"/>
+                                <include reference="Pvi-Wv-s7Q"/>
+                                <include reference="2Hh-7b-Cr1"/>
+                                <include reference="Yfo-47-OeF"/>
+                                <include reference="tjD-kp-s3D"/>
+                                <include reference="IDZ-q7-DAM"/>
+                                <include reference="Rv6-Vd-AU0"/>
+                                <include reference="b5u-Xv-NO9"/>
+                                <include reference="ecu-ka-7Kw"/>
+                                <include reference="hbN-Zu-Pll"/>
+                                <include reference="6Uu-lh-pOC"/>
+                                <include reference="h3X-Sv-4VE"/>
+                                <include reference="0l7-5q-3zf"/>
+                                <include reference="Wi0-HE-j74"/>
+                                <include reference="hCA-0z-Z6u"/>
+                                <include reference="pTh-mC-e27"/>
+                                <include reference="RFB-IF-30T"/>
+                                <include reference="T4E-f3-xNP"/>
+                                <include reference="bLt-dG-GN6"/>
+                                <include reference="dN1-g3-Mda"/>
+                                <include reference="lpK-C1-TrF"/>
+                            </mask>
+                        </variation>
+                        <variation key="heightClass=compact-widthClass=regular">
+                            <mask key="constraints">
+                                <include reference="3Xa-0l-Yfs"/>
+                                <include reference="cAf-h5-l3V"/>
+                                <include reference="fKq-KT-Btl"/>
+                                <include reference="w45-Qc-74D"/>
+                                <include reference="B3m-FM-7Wx"/>
+                                <include reference="rco-TJ-C6H"/>
+                                <include reference="ruP-WY-u3Q"/>
+                                <include reference="02G-Zl-PJ1"/>
+                                <include reference="3Zf-6r-xDu"/>
+                                <include reference="Q7L-Cg-Rml"/>
+                                <include reference="PFl-di-byG"/>
+                                <include reference="PKZ-co-q6C"/>
+                                <include reference="RPz-TG-EgB"/>
+                                <include reference="vZx-LD-eJX"/>
+                                <include reference="IP5-P6-wmP"/>
+                                <include reference="mP3-Aw-Eg2"/>
+                                <include reference="ukF-93-xfZ"/>
+                                <include reference="1To-SE-ubO"/>
+                                <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">
+                            <mask key="constraints">
+                                <include reference="7x0-YS-4WJ"/>
+                                <include reference="XPd-Dh-N8o"/>
+                                <include reference="Bdg-Gf-Ion"/>
+                                <include reference="Cyd-MP-wCx"/>
+                                <include reference="dZe-Lr-jbB"/>
+                                <include reference="oUd-Hv-bEF"/>
+                                <include reference="1S0-UD-XmD"/>
+                                <include reference="fRg-I4-wzf"/>
+                                <include reference="hNg-h6-9D6"/>
+                                <include reference="7bo-hf-pL8"/>
+                                <include reference="VVS-oN-KzO"/>
+                                <include reference="gUk-GU-v1u"/>
+                                <include reference="sMx-RK-bdo"/>
+                                <include reference="DDb-NZ-fPw"/>
+                                <include reference="7GX-rm-Lu7"/>
+                                <include reference="XMG-Nj-hPo"/>
+                                <include reference="lgt-jy-gsD"/>
+                                <include reference="sli-1k-i5W"/>
+                                <include reference="vkf-vf-2IX"/>
+                                <include reference="waZ-2w-RW1"/>
+                                <include reference="xdL-hU-8Np"/>
+                                <include reference="Hru-49-ooh"/>
+                                <include reference="mG3-eu-q03"/>
+                                <include reference="xbY-aK-MNO"/>
+                                <include reference="rgN-nI-NeD"/>
+                            </mask>
+                        </variation>
+                    </view>
+                    <connections>
+                        <outlet property="barcodeLabel" destination="RZK-hh-toU" id="bLq-Hr-qvM"/>
+                        <outlet property="cameraBtn" destination="951-qi-5kI" id="ga4-pg-1kV"/>
+                        <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="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"/>
+                    </connections>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="J8c-Ww-m77" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="773.60000000000002" y="80.50974512743629"/>
         </scene>
     </scenes>
 </document>

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

@@ -6,8 +6,8 @@
 //  Copyright © 2017年 USAI. All rights reserved.
 //
 
-#import "BasicViewController.h"
+#import "BasicModeViewController.h"
 
-@interface ModelModeViewController : BasicViewController
+@interface ModelModeViewController : BasicModeViewController
 
 @end

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

@@ -7,8 +7,22 @@
 //
 
 #import "ModelModeViewController.h"
+#import "JLKeyboardListener.h"
+#import <AVFoundation/AVFoundation.h>
+#import <AssetsLibrary/AssetsLibrary.h>
+
+@interface ModelModeViewController ()<UITextViewDelegate>
+
+@property (strong, nonatomic) IBOutlet UITextView *noteTextView;
+@property (strong, nonatomic) IBOutlet UILabel *barcodeLabel;
+@property (strong, nonatomic) IBOutlet UIButton *imgBtn;
+@property (strong, nonatomic) IBOutlet UIButton *manufactureBtn;
+@property (strong, nonatomic) IBOutlet UIButton *scanBtn;
+@property (strong, nonatomic) IBOutlet UIButton *cameraBtn;
+@property (strong, nonatomic) IBOutlet UIButton *uploadBtn;
+@property (strong, nonatomic) IBOutlet UIButton *typeBtn;
+
 
-@interface ModelModeViewController ()
 
 @end
 
@@ -17,13 +31,72 @@
 - (void)viewDidLoad {
     [super viewDidLoad];
     // Do any additional setup after loading the view.
-    self.view.backgroundColor = [UIColor blueColor];
+    self.noteTextView.layer.borderColor = [UIColor blackColor].CGColor;
+    self.noteTextView.layer.borderWidth = 1.0f;    
+    [self registListenKeyboard];
 }
 
+
+
 - (void)didReceiveMemoryWarning {
     [super didReceiveMemoryWarning];
     // Dispose of any resources that can be recreated.
 }
 
+#pragma mark - Button Action
+
+- (IBAction)imgBtnClick:(UIButton *)sender {
+    self.barcodeLabel.text = @"img";
+}
+
+- (IBAction)manufactureBtnClick:(UIButton *)sender {
+    self.barcodeLabel.text = @"manu";
+}
+
+- (IBAction)scanBtnClick:(UIButton *)sender {
+    [self showScanner];
+}
+
+- (IBAction)cameraBtnClick:(id)sender {
+    [self clickCameraButton];
+}
+
+- (IBAction)uploadBtnClick:(id)sender {
+    self.barcodeLabel.text = @"upl";
+}
+- (IBAction)typeBtnClick:(UIButton *)sender {
+}
+
+#pragma mark - Super Method
+
+- (void)receiveImage:(UIImage *)img {
+    if (img) {
+        [self.imgBtn setBackgroundImage:img forState:UIControlStateNormal];
+    }
+}
+
+- (void)receiveBarcode:(NSString *)code {
+    if (code.length) {
+        self.barcodeLabel.text = [NSString stringWithFormat:@"Model:%@",code];
+    }
+}
+
+#pragma mark - TextView Delegate
+
+- (BOOL)textViewShouldBeginEditing:(UITextView *)textView {
+    self.currentFirstResponder = textView;
+    return YES;
+}
+
+- (BOOL)textViewShouldEndEditing:(UITextView *)textView {
+    self.currentFirstResponder = nil;
+    return YES;
+}
+
+
+
+
+
+
 
 @end

+ 2 - 2
RA Image/RA Image/PopModeViewController.h

@@ -6,9 +6,9 @@
 //  Copyright © 2017年 USAI. All rights reserved.
 //
 
-#import "BasicViewController.h"
+#import "BasicModeViewController.h"
 
-@interface PopModeViewController : BasicViewController
+@interface PopModeViewController : BasicModeViewController
 
 
 

+ 30 - 5
RA Image/RA Image/PopModeViewController.m

@@ -14,6 +14,7 @@
 @property (strong, nonatomic) IBOutlet UIButton *uploadBtn;
 @property (strong, nonatomic) IBOutlet UIButton *imgBtn;
 @property (strong, nonatomic) IBOutlet UILabel *barcodeLabel;
+@property (strong, nonatomic) IBOutlet UIButton *typeBtn;
 
 @end
 
@@ -32,19 +33,43 @@
 
 #pragma mark - Button Action
 
+- (IBAction)imgBtnClick:(UIButton *)sender {
+    self.barcodeLabel.text = @"img";
+}
+
 - (IBAction)scanBtnClick:(UIButton *)sender {
-    NSLog(@"%s",__FUNCTION__);
-    self.barcodeLabel.text = @"scan";
+    [self showScanner];
 }
 
 - (IBAction)cameraBtnClick:(UIButton *)sender {
-    NSLog(@"%s",__FUNCTION__);
-    self.barcodeLabel.text = @"camera";
+    [self clickCameraButton];
 }
 
 - (IBAction)uploadBtnClick:(UIButton *)sender {
-    NSLog(@"%s",__FUNCTION__);
     self.barcodeLabel.text = @"upload";
 }
 
+- (IBAction)typeBtnClick:(UIButton *)sender {
+    [self showBarcodeInput];
+}
+
+#pragma mark - Super Method
+
+- (void)receiveImage:(UIImage *)img {
+    if (img) {
+        [self.imgBtn setBackgroundImage:img forState:UIControlStateNormal];
+    }
+}
+
+- (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];
+}
+
 @end

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

@@ -38,6 +38,8 @@ static NSString *kLastMode = @"lastChooseMode";
     self.title = appDelegate.companyName;
     self.modeList = appDelegate.modeList;
     self.modeTable.tableFooterView = [UIView new];
+    
+    [self removeFirstResponderTap]; // 不然cell接受不了消息
 }
 
 - (void)viewWillAppear:(BOOL)animated {
@@ -126,7 +128,7 @@ static NSString *kLastMode = @"lastChooseMode";
 - (void)pushCurrentModeController:(NSString *)mode {
     BasicViewController *modeVC = nil;
     if ([mode isEqualToString:@"Model"]) {
-        ModelModeViewController *vc = [[ModelModeViewController alloc] init];
+        ModelModeViewController *vc = (ModelModeViewController *)[self viewControllerInStoryboard:@"Mode" withId:@"ModelModeViewController"];
         modeVC = vc;
     }else if ([mode isEqualToString:@"POP"]) {
         PopModeViewController *vc = [[UIStoryboard storyboardWithName:@"Mode" bundle:nil] instantiateViewControllerWithIdentifier:@"PopModeViewController"];