浏览代码

view image

marinofaggiana 4 年之前
父节点
当前提交
cbcc01e082

+ 4 - 2
iOSClient/Viewer/NCViewerImage/NCViewerImage.storyboard

@@ -114,6 +114,9 @@
                                         <subviews>
                                         <subviews>
                                             <mapView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" mapType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="Typ-A8-XIO">
                                             <mapView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" mapType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="Typ-A8-XIO">
                                                 <rect key="frame" x="15" y="97" width="384" height="174"/>
                                                 <rect key="frame" x="15" y="97" width="384" height="174"/>
+                                                <constraints>
+                                                    <constraint firstAttribute="height" constant="174" id="VRv-eR-bwo"/>
+                                                </constraints>
                                             </mapView>
                                             </mapView>
                                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="oov-9f-Oeu">
                                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="oov-9f-Oeu">
                                                 <rect key="frame" x="15" y="271" width="384" height="29"/>
                                                 <rect key="frame" x="15" y="271" width="384" height="29"/>
@@ -141,12 +144,11 @@
                                             <constraint firstAttribute="trailing" secondItem="oov-9f-Oeu" secondAttribute="trailing" constant="15" id="mpQ-4V-Yfc"/>
                                             <constraint firstAttribute="trailing" secondItem="oov-9f-Oeu" secondAttribute="trailing" constant="15" id="mpQ-4V-Yfc"/>
                                             <constraint firstAttribute="trailing" secondItem="Typ-A8-XIO" secondAttribute="trailing" constant="15" id="nAm-fh-5Px"/>
                                             <constraint firstAttribute="trailing" secondItem="Typ-A8-XIO" secondAttribute="trailing" constant="15" id="nAm-fh-5Px"/>
                                             <constraint firstItem="Son-CZ-zFa" firstAttribute="leading" secondItem="P8R-4f-zAl" secondAttribute="leading" constant="15" id="vsg-gX-rNv"/>
                                             <constraint firstItem="Son-CZ-zFa" firstAttribute="leading" secondItem="P8R-4f-zAl" secondAttribute="leading" constant="15" id="vsg-gX-rNv"/>
-                                            <constraint firstAttribute="height" constant="300" id="zD7-Vw-cAA"/>
                                         </constraints>
                                         </constraints>
                                         <connections>
                                         <connections>
                                             <outlet property="dateLabel" destination="Son-CZ-zFa" id="0Wi-XW-0hw"/>
                                             <outlet property="dateLabel" destination="Son-CZ-zFa" id="0Wi-XW-0hw"/>
-                                            <outlet property="detailViewHeightConstraint" destination="zD7-Vw-cAA" id="gUw-lv-4eV"/>
                                             <outlet property="locationButton" destination="oov-9f-Oeu" id="cGg-Gb-m5S"/>
                                             <outlet property="locationButton" destination="oov-9f-Oeu" id="cGg-Gb-m5S"/>
+                                            <outlet property="mapHeightConstraint" destination="VRv-eR-bwo" id="jXn-vm-aJk"/>
                                             <outlet property="mapView" destination="Typ-A8-XIO" id="XCg-a6-NUq"/>
                                             <outlet property="mapView" destination="Typ-A8-XIO" id="XCg-a6-NUq"/>
                                         </connections>
                                         </connections>
                                     </view>
                                     </view>

+ 14 - 20
iOSClient/Viewer/NCViewerImage/NCViewerImageDetailView.swift

@@ -26,7 +26,7 @@ import MapKit
 
 
 class NCViewerImageDetailView: UIView {
 class NCViewerImageDetailView: UIView {
     
     
-    @IBOutlet weak var detailViewHeightConstraint: NSLayoutConstraint!
+    @IBOutlet weak var mapHeightConstraint: NSLayoutConstraint!
     @IBOutlet weak var dateLabel: UILabel!
     @IBOutlet weak var dateLabel: UILabel!
     @IBOutlet weak var mapView: MKMapView!
     @IBOutlet weak var mapView: MKMapView!
     @IBOutlet weak var locationButton: UIButton!
     @IBOutlet weak var locationButton: UIButton!
@@ -35,6 +35,7 @@ class NCViewerImageDetailView: UIView {
     var longitude: Double = 0
     var longitude: Double = 0
     var location: String?
     var location: String?
     var date: NSDate?
     var date: NSDate?
+    var heightMap: CGFloat = 0
     
     
     override func awakeFromNib() {
     override func awakeFromNib() {
         super.awakeFromNib()
         super.awakeFromNib()
@@ -45,17 +46,7 @@ class NCViewerImageDetailView: UIView {
         mapView.isUserInteractionEnabled = false
         mapView.isUserInteractionEnabled = false
     }
     }
     
     
-    func hasData() -> Bool {
-        if latitude > 0 && longitude > 0 {
-            return true
-        } else {
-            return false
-        }
-    }
-    
-    func show(height: CGFloat, textColor: UIColor) {
-        detailViewHeightConstraint.constant = height
-        dateLabel.textColor = textColor
+    func show() {
         isHidden = false
         isHidden = false
     }
     }
     
     
@@ -69,17 +60,18 @@ class NCViewerImageDetailView: UIView {
     
     
     //MARK: - EXIF
     //MARK: - EXIF
     
     
-    func updateExifLocal(metadata: tableMetadata) {
+    func update(metadata: tableMetadata, heightMap:  CGFloat, textColor: UIColor) {
                     
                     
+        self.heightMap = heightMap
+        dateLabel.textColor = textColor
+        
         if metadata.typeFile == k_metadataTypeFile_image {
         if metadata.typeFile == k_metadataTypeFile_image {
             CCUtility.setExif(metadata) { (latitude, longitude, location, date) in
             CCUtility.setExif(metadata) { (latitude, longitude, location, date) in
-                if latitude > 0 && longitude > 0 {
-                    self.latitude = latitude
-                    self.longitude = longitude
-                    self.location = location
-                    self.date = date as NSDate?
-                    self.updateContent()
-                }
+                self.latitude = latitude
+                self.longitude = longitude
+                self.location = location
+                self.date = date as NSDate?
+                self.updateContent()
             };
             };
         }
         }
     
     
@@ -118,6 +110,8 @@ class NCViewerImageDetailView: UIView {
         mapView.addAnnotation(annotation)
         mapView.addAnnotation(annotation)
         mapView.setRegion(MKCoordinateRegion(center: annotation.coordinate, latitudinalMeters: 500, longitudinalMeters: 500), animated: false)
         mapView.setRegion(MKCoordinateRegion(center: annotation.coordinate, latitudinalMeters: 500, longitudinalMeters: 500), animated: false)
         locationButton.setTitle(location, for: .normal)
         locationButton.setTitle(location, for: .normal)
+        
+        mapHeightConstraint.constant = self.heightMap
     }
     }
     
     
     //MARK: - Action
     //MARK: - Action

+ 8 - 10
iOSClient/Viewer/NCViewerImage/NCViewerImageZoom.swift

@@ -105,7 +105,13 @@ class NCViewerImageZoom: UIViewController {
     override func viewDidAppear(_ animated: Bool) {
     override func viewDidAppear(_ animated: Bool) {
         super.viewDidAppear(animated)
         super.viewDidAppear(animated)
         
         
-        detailView.updateExifLocal(metadata: metadata)
+        guard let textColor = self.viewerImage?.textColor else {return }
+        var heightMap = (view.bounds.height / 3)
+        if view.bounds.width < view.bounds.height {
+            heightMap = (view.bounds.width / 3)
+        }
+        
+        detailView.update(metadata: metadata, heightMap: heightMap, textColor: textColor)
         detailViewTopConstraint.constant = 0
         detailViewTopConstraint.constant = 0
         detailView.hide()
         detailView.hide()
         
         
@@ -183,14 +189,7 @@ class NCViewerImageZoom: UIViewController {
             // OPEN DETAIL
             // OPEN DETAIL
             if imageView.center.y < view.center.y - 50 {
             if imageView.center.y < view.center.y - 50 {
                 
                 
-                if !detailView.hasData() { return }
-                guard let textColor = self.viewerImage?.textColor else {return }
-                
-                var height = (view.bounds.height / 3) * 2
-                if view.bounds.width < view.bounds.height {
-                    height = (view.bounds.width / 3) * 2
-                }
-                detailView.show(height: height, textColor: textColor)
+                detailView.show()
             }
             }
             
             
             // CLOSE DETAIL
             // CLOSE DETAIL
@@ -198,7 +197,6 @@ class NCViewerImageZoom: UIViewController {
                 
                 
                 if detailView.isShow() {
                 if detailView.isShow() {
                     detailView.hide()
                     detailView.hide()
-//                    gestureRecognizer.state = .ended
                 }
                 }
             }
             }