Commit 9e499913 authored by 曹云霄's avatar 曹云霄

修改界面

parent 40d8fc4f
......@@ -23,6 +23,8 @@
29D9E2722051182900E1C3F5 /* Color+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29D9E2712051182800E1C3F5 /* Color+Extension.swift */; };
29D9E27420511E8C00E1C3F5 /* DensityResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29D9E27320511E8C00E1C3F5 /* DensityResult.swift */; };
29D9E27A2051216000E1C3F5 /* AxisValueFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29D9E2792051216000E1C3F5 /* AxisValueFormatter.swift */; };
29D9E38C20513A7100E1C3F5 /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29D9E38B20513A7100E1C3F5 /* DetailViewController.swift */; };
29D9E39020513F6500E1C3F5 /* UIView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29D9E38F20513F6500E1C3F5 /* UIView+Extension.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
......@@ -44,6 +46,8 @@
29D9E2712051182800E1C3F5 /* Color+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Color+Extension.swift"; sourceTree = "<group>"; };
29D9E27320511E8C00E1C3F5 /* DensityResult.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DensityResult.swift; sourceTree = "<group>"; };
29D9E2792051216000E1C3F5 /* AxisValueFormatter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AxisValueFormatter.swift; sourceTree = "<group>"; };
29D9E38B20513A7100E1C3F5 /* DetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailViewController.swift; sourceTree = "<group>"; };
29D9E38F20513F6500E1C3F5 /* UIView+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Extension.swift"; sourceTree = "<group>"; };
741C820678A2593F5FCD1236 /* Pods-SHZX.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SHZX.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SHZX/Pods-SHZX.debug.xcconfig"; sourceTree = "<group>"; };
F4B2B6ED73482878EC2355ED /* Pods_SHZX.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SHZX.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
......@@ -113,6 +117,7 @@
children = (
29D7E018204E72DB00010071 /* AppDelegate.swift */,
29D7E01A204E72DB00010071 /* ViewController.swift */,
29D9E38B20513A7100E1C3F5 /* DetailViewController.swift */,
29D9E2782051213C00E1C3F5 /* Formatter */,
29D9E26E20510DDA00E1C3F5 /* Extension */,
29266CB3204FF03E000CBB4B /* Response */,
......@@ -130,6 +135,7 @@
children = (
29D9E26F20510DED00E1C3F5 /* Date+Extensions.swift */,
29D9E2712051182800E1C3F5 /* Color+Extension.swift */,
29D9E38F20513F6500E1C3F5 /* UIView+Extension.swift */,
);
path = Extension;
sourceTree = "<group>";
......@@ -295,8 +301,10 @@
buildActionMask = 2147483647;
files = (
29D9E27420511E8C00E1C3F5 /* DensityResult.swift in Sources */,
29D9E39020513F6500E1C3F5 /* UIView+Extension.swift in Sources */,
29D7E01B204E72DB00010071 /* ViewController.swift in Sources */,
29D9E27A2051216000E1C3F5 /* AxisValueFormatter.swift in Sources */,
29D9E38C20513A7100E1C3F5 /* DetailViewController.swift in Sources */,
29D9E2722051182900E1C3F5 /* Color+Extension.swift in Sources */,
29D9E27020510DED00E1C3F5 /* Date+Extensions.swift in Sources */,
29266CB2204FEE57000CBB4B /* NetworkAPI.swift in Sources */,
......@@ -443,7 +451,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 2G3393EZPN;
DEVELOPMENT_TEAM = W54V2VB863;
INFOPLIST_FILE = SHZX/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
......@@ -460,7 +468,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 2G3393EZPN;
DEVELOPMENT_TEAM = W54V2VB863;
INFOPLIST_FILE = SHZX/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
......
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"filename" : "logo(1)iPadNotifications_20pt.png",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"idiom" : "ipad",
"filename" : "logo(1)iPadNotifications_20pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"idiom" : "ipad",
"filename" : "logo(1)iPadSpootlight5_29pt.png",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"idiom" : "ipad",
"filename" : "logo(1)iPadSpootlight5_29pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"idiom" : "ipad",
"filename" : "logo(1)iPadSpootlight7_40pt.png",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"idiom" : "ipad",
"filename" : "logo(1)iPadSpootlight7_40pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"idiom" : "ipad",
"filename" : "logo(1)iPadApp_76pt.png",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"idiom" : "ipad",
"filename" : "logo(1)iPadApp_76pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "logo(1)iPadProApp_83.5pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "logo(1)store_1024pt.png",
"scale" : "1x"
}
],
......
......@@ -2,16 +2,15 @@
"images" : [
{
"idiom" : "universal",
"filename" : "back.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "back@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "back@3x.png",
"scale" : "3x"
}
],
......
{
"images" : [
{
"idiom" : "universal",
"filename" : "zoom.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -86,51 +86,50 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="今日每小时进入园区人数(人)" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5aG-zl-dDT">
<rect key="frame" x="106" y="296.5" width="186" height="16"/>
<rect key="frame" x="163" y="296" width="186" height="16"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="13"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fa1-tZ-PWR" customClass="LineChartView" customModule="Charts">
<rect key="frame" x="26" y="53" width="460.5" height="229"/>
<rect key="frame" x="26" y="53" width="460.5" height="239"/>
<color key="backgroundColor" red="0.99215686270000003" green="0.61568627450000002" blue="0.30980392159999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="green_curve" translatesAutoresizingMaskIntoConstraints="NO" id="mVp-Aq-ZwF">
<rect key="frame" x="76" y="327" width="20" height="7"/>
<rect key="frame" x="133" y="326.5" width="20" height="7"/>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="red_ curve" translatesAutoresizingMaskIntoConstraints="NO" id="5v6-Ef-vdD">
<rect key="frame" x="76" y="302" width="20" height="5"/>
<rect key="frame" x="133" y="301.5" width="20" height="5"/>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="昨日每小时进入园区人数(人)" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wYd-ks-8y4">
<rect key="frame" x="106" y="322.5" width="186" height="16"/>
<rect key="frame" x="163" y="322" width="186" height="16"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="13"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="5aG-zl-dDT" firstAttribute="leading" secondItem="wYd-ks-8y4" secondAttribute="leading" id="3I6-Sa-khm"/>
<constraint firstItem="mVp-Aq-ZwF" firstAttribute="centerY" secondItem="wYd-ks-8y4" secondAttribute="centerY" id="3WL-W5-kge"/>
<constraint firstItem="ZbM-aF-dlm" firstAttribute="centerY" secondItem="64y-FG-uG1" secondAttribute="centerY" id="4ML-gR-9Mm"/>
<constraint firstItem="ZbM-aF-dlm" firstAttribute="leading" secondItem="64y-FG-uG1" secondAttribute="trailing" constant="10" id="6mg-PX-iut"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="wYd-ks-8y4" secondAttribute="trailing" constant="20" symbolic="YES" id="9G5-qy-3HX"/>
<constraint firstItem="5aG-zl-dDT" firstAttribute="leading" secondItem="5v6-Ef-vdD" secondAttribute="trailing" constant="10" id="G6s-77-Opd"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="5aG-zl-dDT" secondAttribute="trailing" constant="20" symbolic="YES" id="HN2-jY-Z1f"/>
<constraint firstItem="5v6-Ef-vdD" firstAttribute="leading" secondItem="fa1-tZ-PWR" secondAttribute="leading" constant="50" id="KbW-rT-TNx"/>
<constraint firstItem="mVp-Aq-ZwF" firstAttribute="top" secondItem="5v6-Ef-vdD" secondAttribute="bottom" constant="20" id="O2h-D8-ZhE"/>
<constraint firstItem="wYd-ks-8y4" firstAttribute="centerX" secondItem="zeI-fJ-Vvx" secondAttribute="centerX" id="I3X-Ft-pZ0"/>
<constraint firstItem="5aG-zl-dDT" firstAttribute="leading" secondItem="5v6-Ef-vdD" secondAttribute="trailing" constant="10" id="UAd-EZ-WLg"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="ZbM-aF-dlm" secondAttribute="trailing" constant="20" symbolic="YES" id="WEd-TZ-cna"/>
<constraint firstItem="5aG-zl-dDT" firstAttribute="centerY" secondItem="5v6-Ef-vdD" secondAttribute="centerY" id="Z7K-9X-eE0"/>
<constraint firstItem="5v6-Ef-vdD" firstAttribute="top" secondItem="fa1-tZ-PWR" secondAttribute="bottom" constant="20" id="mho-09-Kmv"/>
<constraint firstItem="5v6-Ef-vdD" firstAttribute="centerY" secondItem="5aG-zl-dDT" secondAttribute="centerY" id="dVt-wS-sdZ"/>
<constraint firstItem="5aG-zl-dDT" firstAttribute="centerX" secondItem="wYd-ks-8y4" secondAttribute="centerX" id="dlq-pd-aWE"/>
<constraint firstItem="wYd-ks-8y4" firstAttribute="leading" secondItem="mVp-Aq-ZwF" secondAttribute="trailing" constant="10" id="feT-P9-WoE"/>
<constraint firstItem="wYd-ks-8y4" firstAttribute="top" secondItem="5aG-zl-dDT" secondAttribute="bottom" constant="10" id="hac-Pg-ELC"/>
<constraint firstAttribute="bottom" secondItem="wYd-ks-8y4" secondAttribute="bottom" constant="14" id="mcw-ZD-0rA"/>
<constraint firstItem="fa1-tZ-PWR" firstAttribute="width" secondItem="zeI-fJ-Vvx" secondAttribute="width" multiplier="0.9" id="ovf-rG-iuk"/>
<constraint firstItem="wYd-ks-8y4" firstAttribute="centerY" secondItem="mVp-Aq-ZwF" secondAttribute="centerY" id="qFe-Gk-cPr"/>
<constraint firstItem="fa1-tZ-PWR" firstAttribute="top" secondItem="ZbM-aF-dlm" secondAttribute="bottom" constant="13" id="qWj-2a-hy2"/>
<constraint firstItem="64y-FG-uG1" firstAttribute="top" secondItem="zeI-fJ-Vvx" secondAttribute="top" constant="20" id="uML-jw-F3S"/>
<constraint firstItem="64y-FG-uG1" firstAttribute="leading" secondItem="zeI-fJ-Vvx" secondAttribute="leading" constant="20" id="wcb-oG-USI"/>
<constraint firstItem="wYd-ks-8y4" firstAttribute="leading" secondItem="mVp-Aq-ZwF" secondAttribute="trailing" constant="10" id="xIv-lG-KSH"/>
<constraint firstItem="fa1-tZ-PWR" firstAttribute="centerX" secondItem="zeI-fJ-Vvx" secondAttribute="centerX" id="xwd-f9-J67"/>
<constraint firstAttribute="bottom" secondItem="fa1-tZ-PWR" secondAttribute="bottom" constant="70" id="z4w-kO-8zA"/>
<constraint firstItem="mVp-Aq-ZwF" firstAttribute="centerX" secondItem="5v6-Ef-vdD" secondAttribute="centerX" id="zeO-Jx-v0e"/>
<constraint firstAttribute="bottom" secondItem="fa1-tZ-PWR" secondAttribute="bottom" constant="60" id="z4w-kO-8zA"/>
</constraints>
</view>
<view tag="1" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="8jp-7V-3KE">
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="8jp-7V-3KE">
<rect key="frame" x="512" y="64" width="512" height="352"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="f0y-Zh-0Wu">
......@@ -144,7 +143,7 @@
<constraint firstAttribute="trailing" secondItem="f0y-Zh-0Wu" secondAttribute="trailing" id="zpN-Fk-qV6"/>
</constraints>
</view>
<view tag="2" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="vWu-BX-HqD">
<view tag="1" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="vWu-BX-HqD">
<rect key="frame" x="0.0" y="416" width="512" height="352"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Ql6-HJ-UMe">
......@@ -176,14 +175,15 @@
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="rSE-Wh-AbK" customClass="BarChartView" customModule="Charts">
<rect key="frame" x="20" y="53.5" width="472" height="248.5"/>
<rect key="frame" x="20" y="53.5" width="472" height="258.5"/>
<color key="backgroundColor" red="0.99215686270000003" green="0.61568627450000002" blue="0.30980392159999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</subviews>
<constraints>
<constraint firstItem="rSE-Wh-AbK" firstAttribute="leading" secondItem="0we-8C-fnz" secondAttribute="leading" constant="20" id="1jB-YM-fys"/>
<constraint firstAttribute="bottom" secondItem="rSE-Wh-AbK" secondAttribute="bottom" constant="50" id="D2j-sB-CGu"/>
<constraint firstAttribute="bottom" secondItem="rSE-Wh-AbK" secondAttribute="bottom" constant="40" id="D2j-sB-CGu"/>
<constraint firstAttribute="trailing" secondItem="rSE-Wh-AbK" secondAttribute="trailing" constant="20" id="JfH-fl-ObY"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="Y1z-MT-VLu" secondAttribute="trailing" constant="20" symbolic="YES" id="ODT-dP-ope"/>
<constraint firstItem="Y1z-MT-VLu" firstAttribute="centerY" secondItem="L4g-uz-BMo" secondAttribute="centerY" id="b7J-Cx-ase"/>
<constraint firstItem="rSE-Wh-AbK" firstAttribute="top" secondItem="Y1z-MT-VLu" secondAttribute="bottom" constant="13" id="bt6-p1-uPq"/>
<constraint firstItem="L4g-uz-BMo" firstAttribute="top" secondItem="0we-8C-fnz" secondAttribute="top" constant="20" id="dO3-ml-Nqf"/>
......@@ -237,12 +237,46 @@
</objects>
<point key="canvasLocation" x="24.609375" y="33.59375"/>
</scene>
<!--Detail View Controller-->
<scene sceneID="2LP-73-gMt">
<objects>
<viewController storyboardIdentifier="DetailViewController" id="7IM-UV-9ge" customClass="DetailViewController" customModule="SHZX" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="keo-kg-nPW">
<rect key="frame" x="0.0" y="0.0" width="1024" height="768"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="9Pu-RN-zVm">
<rect key="frame" x="964" y="708" width="30" height="30"/>
<color key="backgroundColor" red="0.13725490200000001" green="0.56862745100000001" blue="0.80392156859999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="30" id="Pnm-cO-AaG"/>
<constraint firstAttribute="height" constant="30" id="qhC-hn-1jf"/>
</constraints>
<state key="normal" image="zoom"/>
<connections>
<action selector="dismissClickAction:" destination="7IM-UV-9ge" eventType="touchUpInside" id="UcV-nu-Cdh"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="gcL-jW-Ayj" firstAttribute="bottom" secondItem="9Pu-RN-zVm" secondAttribute="bottom" constant="30" id="F65-qN-Pt1"/>
<constraint firstItem="gcL-jW-Ayj" firstAttribute="trailing" secondItem="9Pu-RN-zVm" secondAttribute="trailing" constant="30" id="qMn-5X-CvI"/>
</constraints>
<viewLayoutGuide key="safeArea" id="gcL-jW-Ayj"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="At3-gG-ebT" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="673.828125" y="33.59375"/>
</scene>
</scenes>
<resources>
<image name="back" width="1024" height="768"/>
<image name="back" width="2048" height="1536"/>
<image name="green_curve" width="20" height="7"/>
<image name="logo" width="120" height="47"/>
<image name="red_ curve" width="20" height="5"/>
<image name="update" width="70" height="70"/>
<image name="zoom" width="128" height="128"/>
</resources>
</document>
//
// DetailViewController.swift
// SHZX
//
// Created by 曹云霄 on 2018/3/8.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
import WebKit
class DetailViewController: UIViewController {
final var webView: WKWebView!
open var imageString: String!
override func viewDidLoad() {
super.viewDidLoad()
setupWebView()
}
// MARK: - 初始化WKWebView
fileprivate func setupWebView() {
webView = WKWebView(frame: CGRect(x: 0, y: 64, width: UIScreen.main.bounds.size.width, height: UIScreen.main.bounds.size.height))
view.addSubview(webView)
view.sendSubview(toBack: webView)
webView.load(URLRequest(url: URL(string: imageString)!))
}
// MARK: - 关闭
@IBAction func dismissClickAction(_ sender: UIButton) {
dismiss(animated: true, completion: nil)
}
}
......@@ -28,6 +28,16 @@ extension Date {
return nil
}
}
//MARK: date转日期字符串
public func dateToDateString(dateFormat:String) -> String {
let timeZone = NSTimeZone.local
let formatter = DateFormatter()
formatter.timeZone = timeZone
formatter.dateFormat = dateFormat
let date = formatter.string(from: self)
return date
}
/// EZSE: Initializes Date from string returned from an http response, according to several RFCs / ISO
public init?(httpDateString: String) {
......
//
// UIView+Extension.swift
// SHZX
//
// Created by 曹云霄 on 2018/3/8.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
extension UIView {
func copyView<T: UIView>() -> T {
return NSKeyedUnarchiver.unarchiveObject(with: NSKeyedArchiver.archivedData(withRootObject: self)) as! T
}
}
......@@ -4,6 +4,8 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>上海中心</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
......@@ -15,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.0.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>1.0.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
......
......@@ -27,7 +27,7 @@ class ViewController: UIViewController {
var oldFrame: CGRect!
/// 横坐标title
final lazy var xTitles: Array<String> = {
var xTitles = ["8", "11", "14", "17", "20","23"]
var xTitles = ["8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23"]
return xTitles
}()
......@@ -37,6 +37,12 @@ class ViewController: UIViewController {
/// 登陆用户信息
var userData: LoginData!
var imageArray: Array<String> = {
var imageArray = ["http://121.40.116.34:8077/KlImages/KlyAPI?ID=2&Type=SHZX","http://121.40.116.34:8077/KlImages/KlyAPI?ID=2&Type=SHZX"]
return imageArray
}()
override func viewDidLoad() {
super.viewDidLoad()
......@@ -65,13 +71,13 @@ class ViewController: UIViewController {
// MARK: - 拍摄照片
fileprivate func setupPhotoImg() {
photoImg1.kf.setImage(with: URL(string: "http://121.40.116.34:8077/KlImages/KlyAPI?ID=1&Type=SHZX"))
photoImg2.kf.setImage(with: URL(string: "http://121.40.116.34:8077/KlImages/KlyAPI?ID=2&Type=SHZX"))
photoImg1.kf.setImage(with: ImageResource(downloadURL: URL(string: imageArray.first!)!), placeholder: nil, options: [KingfisherOptionsInfoItem.transition(ImageTransition.fade(1)), KingfisherOptionsInfoItem.forceRefresh], progressBlock: nil, completionHandler: nil)
photoImg2.kf.setImage(with: ImageResource(downloadURL: URL(string: imageArray.last!)!), placeholder: nil, options: [KingfisherOptionsInfoItem.transition(ImageTransition.fade(1)), KingfisherOptionsInfoItem.forceRefresh], progressBlock: nil, completionHandler: nil)
}
// MARK: - 获取折线图数据
fileprivate func getSpotsDataAction() {
let time = Date().toString()
let time = Date().dateToDateString(dateFormat: "yyyy-MM-dd HH:mm:ss")
Network.request(target: .Spots(userData.uuid, time), success: {[weak self] (json) in
let model = SpotsResult(fromJson: json)
if model.success {
......@@ -79,15 +85,14 @@ class ViewController: UIViewController {
var yesterdayValue = Array<Double>()
for i in 0..<self!.xTitles.count {
if let count = model.data.last?.hour.object(forKey: self!.xTitles[i]) {
todayValue.append(count as! Double)
yesterdayValue.append(count as! Double)
}else {
todayValue.append(0)
yesterdayValue.append(0)
}
if let count = model.data.first?.hour.object(forKey: self!.xTitles[i]) {
yesterdayValue.append(count as! Double)
todayValue.append(count as! Double)
}else {
yesterdayValue.append(0)
todayValue.append(0)
}
}
self?.setChart(todayValue: todayValue, yesterdayValue: yesterdayValue)
......@@ -101,7 +106,7 @@ class ViewController: UIViewController {
// MARK: - 获取柱状图数据
fileprivate func getDensityDataAction() {
let time = Date().toString()
let time = Date().dateToDateString(dateFormat: "yyyy-MM-dd HH:mm:ss")
Network.request(target: .GETDensity(userData.uuid, time), success: {[weak self] (json) in
let model = DensityResult(fromJson: json)
if model.success {
......@@ -124,14 +129,13 @@ class ViewController: UIViewController {
fileprivate func setupLineChartView() {
chartView.chartDescription?.text = nil
chartView.legend.form = .none
chartView.highlightPerTapEnabled = false
chartView.rightAxis.drawAxisLineEnabled = false
chartView.rightAxis.enabled = false
chartView.leftAxis.axisLineColor = UIColor.white
chartView.leftAxis.gridColor = UIColor.clear
chartView.leftAxis.labelTextColor = UIColor.white
chartView.dragEnabled = false
chartView.doubleTapToZoomEnabled = false
chartView.scaleYEnabled = false
}
// MARK: - 填充折线图数据
......@@ -139,9 +143,11 @@ class ViewController: UIViewController {
var todayDataEntries: [ChartDataEntry] = []
var tyesterdayDataEntries: [ChartDataEntry] = []
for i in 0..<xTitles.count {
let dataEntry = ChartDataEntry(x: Double(i), y: todayValue[i])
todayDataEntries.append(dataEntry)
let time = Date().hour
if Int(xTitles[i])! <= time {
let dataEntry = ChartDataEntry(x: Double(i), y: todayValue[i])
todayDataEntries.append(dataEntry)
}
let dataEntry1 = ChartDataEntry(x: Double(i), y: yesterdayValue[i])
tyesterdayDataEntries.append(dataEntry1)
}
......@@ -178,6 +184,7 @@ class ViewController: UIViewController {
fileprivate func setupBarChartView() {
barChartView.chartDescription?.text = nil
barChartView.legend.form = .none
barChartView.highlightPerTapEnabled = false
barChartView.rightAxis.drawAxisLineEnabled = false
barChartView.rightAxis.enabled = false
barChartView.leftAxis.axisLineColor = UIColor.white
......@@ -187,8 +194,6 @@ class ViewController: UIViewController {
barChartView.xAxis.labelPosition = .bottom
barChartView.xAxis.gridColor = UIColor.clear
barChartView.xAxis.labelTextColor = UIColor.white
barChartView.scaleXEnabled = false
barChartView.scaleYEnabled = false
}
// MARK: - 填充柱状图数据
......@@ -213,33 +218,26 @@ class ViewController: UIViewController {
// MARK: - 添加点击手势
fileprivate func addTapGestureRecognizer() {
lineChartBgView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(ViewController.zoomClickAction)))
histogramBgView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(ViewController.zoomClickAction)))
photoImg1BgView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(ViewController.zoomClickAction)))
photoImg2BgView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(ViewController.zoomClickAction)))
}
// MARK: - 缩放
@objc open func zoomClickAction(_ tap: UIGestureRecognizer) {
let storyBoard = UIStoryboard(name: "Main", bundle: nil)
let detailVc = storyBoard.instantiateViewController(withIdentifier: "DetailViewController") as! DetailViewController
detailVc.imageString = imageArray[tap.view!.tag]
present(detailVc, animated: true, completion: nil)
}
// MARK: - 更新数据
@IBAction func updateBtnClickAction(_ sender: UIButton) {
getSpotsDataAction()
getDensityDataAction()
setupPhotoImg()
}
}
//extension ViewController: IAxisValueFormatter {
// func stringForValue(_ value: Double, axis: AxisBase?) -> String {
// let title = xTitles[Int(value)]
// if title.isEmpty {
// return ""
// }
// return title + ":00"
// }
//}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment