Prechádzať zdrojové kódy

qr코드 스캔뷰의 디자인 수정

서용하 6 rokov pred
rodič
commit
1563c0c67e

+ 3 - 3
MCPlus/Adapter/PhotoCollectionViewAdapter.swift

@@ -62,16 +62,16 @@ extension PhotoCollectionViewAdapter:UICollectionViewDataSource, UICollectionVie
         
         //체크가 되었을 경우 표시를 다르게 한다
         if self.selectedArr.contains(indexPath){
-            cell.check.backgroundColor = UIColor.black
+            cell.check.isChecked = true
         }else{
-            cell.check.backgroundColor = UIColor.clear
+            cell.check.isChecked = false
         }
 
         //길게 누를 경우 이벤트
         cell.addLongPressGestureRecognizer { [weak self] in
             
             let app = UIApplication.shared.delegate as! AppDelegate
-            let nav = app.window?.rootViewController as! UINavigationController
+            let nav = app.visibleViewController?.navigationController as! UINavigationController
             let alert = UIAlertController(title: "선택", message: "", preferredStyle: .actionSheet)
             
             //개별 앨범 이미지를 삭제한다

+ 58 - 20
MCPlus/Base.lproj/Main.storyboard

@@ -86,7 +86,7 @@
                         <autoresizingMask key="autoresizingMask"/>
                     </navigationBar>
                     <connections>
-                        <segue destination="ySz-mN-COb" kind="relationship" relationship="rootViewController" id="P0V-UI-f6L"/>
+                        <segue destination="ySz-mN-COb" kind="relationship" relationship="rootViewController" id="3AS-oF-DZI"/>
                     </connections>
                 </navigationController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="2N1-sD-EIH" userLabel="First Responder" sceneMemberID="firstResponder"/>
@@ -762,12 +762,17 @@
                                                         <imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="hi2-Bv-Fy6">
                                                             <rect key="frame" x="0.0" y="0.0" width="50" height="50"/>
                                                         </imageView>
-                                                        <imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="P8T-Tu-dyy">
-                                                            <rect key="frame" x="30" y="0.0" width="20" height="20"/>
+                                                        <imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="gall_chk_default" translatesAutoresizingMaskIntoConstraints="NO" id="P8T-Tu-dyy" customClass="CheckImageButton" customModule="kunkuk" customModuleProvider="target">
+                                                            <rect key="frame" x="27" y="3" width="20" height="20"/>
                                                             <constraints>
                                                                 <constraint firstAttribute="width" constant="20" id="6tc-XR-7Ca"/>
                                                                 <constraint firstAttribute="height" constant="20" id="cS0-IC-8VS"/>
                                                             </constraints>
+                                                            <userDefinedRuntimeAttributes>
+                                                                <userDefinedRuntimeAttribute type="string" keyPath="checkOn" value="gall_chk_active"/>
+                                                                <userDefinedRuntimeAttribute type="boolean" keyPath="checked" value="NO"/>
+                                                                <userDefinedRuntimeAttribute type="string" keyPath="checkOff" value="gall_chk_default"/>
+                                                            </userDefinedRuntimeAttributes>
                                                         </imageView>
                                                     </subviews>
                                                 </view>
@@ -776,8 +781,8 @@
                                                     <constraint firstAttribute="trailing" secondItem="hi2-Bv-Fy6" secondAttribute="trailing" id="A6N-f9-ILq"/>
                                                     <constraint firstAttribute="bottom" secondItem="hi2-Bv-Fy6" secondAttribute="bottom" id="KC8-7d-mQ9"/>
                                                     <constraint firstItem="hi2-Bv-Fy6" firstAttribute="top" secondItem="LYJ-HX-iwP" secondAttribute="top" id="Pxe-3L-jEo"/>
-                                                    <constraint firstItem="P8T-Tu-dyy" firstAttribute="top" secondItem="LYJ-HX-iwP" secondAttribute="top" id="TCk-Bl-sdI"/>
-                                                    <constraint firstAttribute="trailing" secondItem="P8T-Tu-dyy" secondAttribute="trailing" id="V1N-Do-tAk"/>
+                                                    <constraint firstItem="P8T-Tu-dyy" firstAttribute="top" secondItem="LYJ-HX-iwP" secondAttribute="top" constant="3" id="TCk-Bl-sdI"/>
+                                                    <constraint firstAttribute="trailing" secondItem="P8T-Tu-dyy" secondAttribute="trailing" constant="3" id="V1N-Do-tAk"/>
                                                 </constraints>
                                                 <connections>
                                                     <outlet property="album" destination="hi2-Bv-Fy6" id="E8q-Uq-7v2"/>
@@ -1005,10 +1010,10 @@
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                             <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" maximumZoomScale="6" translatesAutoresizingMaskIntoConstraints="NO" id="2iH-20-RM0">
-                                <rect key="frame" x="0.0" y="94" width="375" height="684"/>
+                                <rect key="frame" x="0.0" y="44" width="375" height="734"/>
                                 <subviews>
                                     <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="5Sc-ew-tv8">
-                                        <rect key="frame" x="0.0" y="0.0" width="375" height="684"/>
+                                        <rect key="frame" x="0.0" y="0.0" width="375" height="734"/>
                                     </imageView>
                                 </subviews>
                                 <constraints>
@@ -1018,31 +1023,19 @@
                                     <constraint firstItem="5Sc-ew-tv8" firstAttribute="centerX" secondItem="2iH-20-RM0" secondAttribute="centerX" id="kcN-vB-r0Y"/>
                                     <constraint firstItem="5Sc-ew-tv8" firstAttribute="leading" secondItem="2iH-20-RM0" secondAttribute="leading" id="odj-gd-DVS"/>
                                     <constraint firstItem="5Sc-ew-tv8" firstAttribute="centerY" secondItem="2iH-20-RM0" secondAttribute="centerY" id="ryf-m9-i2f"/>
-                                    <constraint firstAttribute="width" constant="375" id="tJw-BP-yMg"/>
                                 </constraints>
                             </scrollView>
-                            <imageView contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="iKJ-T8-ujE" userLabel="close">
-                                <rect key="frame" x="15" y="59" width="25" height="25"/>
-                                <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
-                                <constraints>
-                                    <constraint firstAttribute="width" secondItem="iKJ-T8-ujE" secondAttribute="height" multiplier="1:1" id="XNs-ln-ETv"/>
-                                    <constraint firstAttribute="width" constant="25" id="iCe-MO-UAR"/>
-                                </constraints>
-                            </imageView>
                         </subviews>
                         <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                         <constraints>
                             <constraint firstItem="Fph-JF-Fvh" firstAttribute="bottom" secondItem="2iH-20-RM0" secondAttribute="bottom" id="6G2-IC-Da6"/>
-                            <constraint firstItem="2iH-20-RM0" firstAttribute="top" secondItem="Fph-JF-Fvh" secondAttribute="top" constant="50" id="N7V-ku-iqz"/>
-                            <constraint firstItem="iKJ-T8-ujE" firstAttribute="leading" secondItem="Fph-JF-Fvh" secondAttribute="leading" constant="15" id="grU-kQ-iaw"/>
-                            <constraint firstItem="iKJ-T8-ujE" firstAttribute="top" secondItem="Fph-JF-Fvh" secondAttribute="top" constant="15" id="ph9-9b-ePY"/>
+                            <constraint firstItem="2iH-20-RM0" firstAttribute="top" secondItem="Fph-JF-Fvh" secondAttribute="top" id="N7V-ku-iqz"/>
                             <constraint firstItem="Fph-JF-Fvh" firstAttribute="trailing" secondItem="2iH-20-RM0" secondAttribute="trailing" id="rfS-1r-Y7l"/>
                             <constraint firstItem="2iH-20-RM0" firstAttribute="leading" secondItem="Fph-JF-Fvh" secondAttribute="leading" id="sbe-wB-ibT"/>
                         </constraints>
                         <viewLayoutGuide key="safeArea" id="Fph-JF-Fvh"/>
                     </view>
                     <connections>
-                        <outlet property="closeButton" destination="iKJ-T8-ujE" id="KYP-Ak-9lF"/>
                         <outlet property="imageView" destination="5Sc-ew-tv8" id="k1y-Vo-fs3"/>
                         <outlet property="scrollView" destination="2iH-20-RM0" id="OrG-GR-aJ6"/>
                     </connections>
@@ -1090,10 +1083,54 @@
                     <view key="view" contentMode="scaleToFill" id="5qx-dD-4na">
                         <rect key="frame" x="0.0" y="0.0" width="375" height="812"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="oTz-vn-Un2">
+                                <rect key="frame" x="0.0" y="44" width="375" height="48"/>
+                                <subviews>
+                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="스캔" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Tzg-sE-Hgh">
+                                        <rect key="frame" x="170.33333333333334" y="13.666666666666664" width="34.666666666666657" height="21"/>
+                                        <fontDescription key="fontDescription" name="NanumSquareB" family="NanumSquare" pointSize="19"/>
+                                        <nil key="textColor"/>
+                                        <nil key="highlightedColor"/>
+                                    </label>
+                                    <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="close_x" translatesAutoresizingMaskIntoConstraints="NO" id="Dhl-af-Gnu">
+                                        <rect key="frame" x="346" y="13.666666666666664" width="21" height="21"/>
+                                        <constraints>
+                                            <constraint firstAttribute="width" secondItem="Dhl-af-Gnu" secondAttribute="height" multiplier="1:1" id="2HK-aA-anq"/>
+                                            <constraint firstAttribute="height" constant="21" id="n7V-E9-8FP"/>
+                                        </constraints>
+                                    </imageView>
+                                </subviews>
+                                <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                <constraints>
+                                    <constraint firstItem="Tzg-sE-Hgh" firstAttribute="centerX" secondItem="oTz-vn-Un2" secondAttribute="centerX" id="Ngq-eM-UHC"/>
+                                    <constraint firstItem="Dhl-af-Gnu" firstAttribute="centerY" secondItem="oTz-vn-Un2" secondAttribute="centerY" id="TvQ-OD-eCs"/>
+                                    <constraint firstAttribute="height" constant="48" id="gvN-i7-a4J"/>
+                                    <constraint firstItem="Tzg-sE-Hgh" firstAttribute="centerY" secondItem="oTz-vn-Un2" secondAttribute="centerY" id="i7y-rn-L8P"/>
+                                    <constraint firstAttribute="trailing" secondItem="Dhl-af-Gnu" secondAttribute="trailing" constant="8" id="wTD-Cw-IS6"/>
+                                </constraints>
+                            </view>
+                            <containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fY6-cx-P9K">
+                                <rect key="frame" x="0.0" y="92" width="375" height="686"/>
+                            </containerView>
+                        </subviews>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                        <constraints>
+                            <constraint firstItem="oTz-vn-Un2" firstAttribute="trailing" secondItem="fTG-EZ-ZnY" secondAttribute="trailing" id="0aw-GZ-rha"/>
+                            <constraint firstItem="fTG-EZ-ZnY" firstAttribute="bottom" secondItem="fY6-cx-P9K" secondAttribute="bottom" id="aDJ-pN-6Cy"/>
+                            <constraint firstItem="oTz-vn-Un2" firstAttribute="leading" secondItem="fTG-EZ-ZnY" secondAttribute="leading" id="crw-c6-tha"/>
+                            <constraint firstItem="fTG-EZ-ZnY" firstAttribute="trailing" secondItem="fY6-cx-P9K" secondAttribute="trailing" id="fpn-iy-YVw"/>
+                            <constraint firstItem="fY6-cx-P9K" firstAttribute="top" secondItem="oTz-vn-Un2" secondAttribute="bottom" id="pQV-LV-jLf"/>
+                            <constraint firstItem="oTz-vn-Un2" firstAttribute="top" secondItem="fTG-EZ-ZnY" secondAttribute="top" id="rAb-v0-BOn"/>
+                            <constraint firstItem="fY6-cx-P9K" firstAttribute="leading" secondItem="fTG-EZ-ZnY" secondAttribute="leading" id="yPM-Bl-LUn"/>
+                        </constraints>
                         <viewLayoutGuide key="safeArea" id="fTG-EZ-ZnY"/>
                     </view>
                     <navigationItem key="navigationItem" id="GXU-sY-uR3"/>
+                    <connections>
+                        <outlet property="cameraOverlayView" destination="fY6-cx-P9K" id="AcS-Dv-4YP"/>
+                        <outlet property="closeButton" destination="Dhl-af-Gnu" id="bo7-ko-Jo2"/>
+                    </connections>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="4d5-ge-Yuw" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
@@ -1114,6 +1151,7 @@
         <image name="f_btn_camera" width="270" height="150"/>
         <image name="f_btn_list" width="270" height="150"/>
         <image name="forward" width="30" height="30"/>
+        <image name="gall_chk_default" width="66" height="66"/>
         <image name="refresh" width="30" height="30"/>
     </resources>
 </document>

+ 1 - 1
MCPlus/Cell/PhotoCollectionViewCell.swift

@@ -13,6 +13,6 @@ class PhotoCollectionViewCell: UICollectionViewCell {
     
     @IBOutlet weak var album: UIImageView!
     
-    @IBOutlet weak var check: UIImageView!
+    @IBOutlet weak var check: CheckImageButton!
     
 }

+ 21 - 0
MCPlus/Images.xcassets/gall_chk_active.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "gall_chk_active.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
MCPlus/Images.xcassets/gall_chk_active.imageset/gall_chk_active.png


+ 21 - 0
MCPlus/Images.xcassets/gall_chk_default.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "gall_chk_default.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
MCPlus/Images.xcassets/gall_chk_default.imageset/gall_chk_default.png


+ 25 - 15
MCPlus/ViewControllers/BarcodeViewController.swift

@@ -15,6 +15,15 @@ class BarcodeViewController: UIViewController {
     
     var callBack:((String)->Void)?
     
+    @IBOutlet weak var cameraOverlayView: UIView!
+    
+    @IBOutlet weak var closeButton: UIImageView!{
+        didSet{
+            closeButton.addTapGestureRecognizer(action: self.tapAction)
+        }
+    }
+    
+    
 }
 
 extension BarcodeViewController{
@@ -37,19 +46,18 @@ extension BarcodeViewController{
         reader.supportedOrientationsMask = (1 << UIInterfaceOrientation.portraitUpsideDown.rawValue)
         reader.showsZBarControls = false
         
-        let cameraOverlayView = UIView(frame: UIScreen.main.bounds)
-        cameraOverlayView.backgroundColor = UIColor.clear
-
-        let instructionLabel = UILabel(frame: UIScreen.main.bounds)
-        instructionLabel.textColor = UIColor.gray
-        instructionLabel.backgroundColor = UIColor.clear
-        instructionLabel.font = UIFont(name: "Trebuchet MS", size: 24.0)
-        instructionLabel.text = "취소"
-        
-        cameraOverlayView.addSubview(instructionLabel)
-        
-        instructionLabel.addTapGestureRecognizer(action: self.tapAction)
-        reader.cameraOverlayView = cameraOverlayView
+//        let cameraOverlayView = UIView(frame: UIScreen.main.bounds)
+//        cameraOverlayView.backgroundColor = UIColor.clear
+//
+//        let instructionLabel = UILabel(frame: UIScreen.main.bounds)
+//        instructionLabel.textColor = UIColor.gray
+//        instructionLabel.backgroundColor = UIColor.clear
+//        instructionLabel.font = UIFont(name: "Trebuchet MS", size: 24.0)
+//        instructionLabel.text = "취소"
+//
+//        cameraOverlayView.addSubview(instructionLabel)
+//
+//        instructionLabel.addTapGestureRecognizer(action: self.tapAction)
         
         let scanner = reader.scanner
         
@@ -60,8 +68,10 @@ extension BarcodeViewController{
         
         // present and release the controller
         
-        self.present(reader, animated: true, completion: nil)
-
+//        self.present(reader, animated: true, completion: nil)
+        reader.view.frame = self.cameraOverlayView.bounds
+        self.cameraOverlayView.addSubview(reader.view)
+        self.addChild(self.reader)
     }
 }
 

+ 1 - 0
MCPlus/ViewControllers/WebViewController.swift

@@ -55,6 +55,7 @@ extension WebViewController{
     
     override func viewDidLoad() {
         super.viewDidLoad()
+        
         self.navigationController?.navigationBar.isHidden = true
         //    status bar 폰트 흰색으로, plist 파일에 View controller-based status bar appearance : NO를 추가해야함
         self.setStatusBarBackgroundColor(color: .white)