Skip to content

Commit

Permalink
half
Browse files Browse the repository at this point in the history
  • Loading branch information
ccworld1000 committed Mar 21, 2018
1 parent ac634dc commit ed395f9
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 5 deletions.
4 changes: 4 additions & 0 deletions OKKLineMin.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
0012EE872019C6F600EEED92 /* OKSegmentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0012EE732019C6F600EEED92 /* OKSegmentView.swift */; };
0012EE882019C6F600EEED92 /* OKKLineVolumeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0012EE752019C6F600EEED92 /* OKKLineVolumeView.swift */; };
0012EE8A2019C78700EEED92 /* OKKLineMinVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0012EE892019C78700EEED92 /* OKKLineMinVC.swift */; };
006D8FCF20625C17008168AA /* CCKlineVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 006D8FCE20625C17008168AA /* CCKlineVC.swift */; };
009ECEDF204FC8F200558BC0 /* CCSQLiteData.sqlite-shm in Resources */ = {isa = PBXBuildFile; fileRef = 009ECEDD204FC8F200558BC0 /* CCSQLiteData.sqlite-shm */; };
009ECEE0204FC8F200558BC0 /* CCSQLiteData.sqlite-wal in Resources */ = {isa = PBXBuildFile; fileRef = 009ECEDE204FC8F200558BC0 /* CCSQLiteData.sqlite-wal */; };
23D0DC9865F8048FC3BCFB74 /* Pods_OKKLineMin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C95C251741823382CBC59A5D /* Pods_OKKLineMin.framework */; };
Expand Down Expand Up @@ -71,6 +72,7 @@
0012EE732019C6F600EEED92 /* OKSegmentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OKSegmentView.swift; sourceTree = "<group>"; };
0012EE752019C6F600EEED92 /* OKKLineVolumeView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OKKLineVolumeView.swift; sourceTree = "<group>"; };
0012EE892019C78700EEED92 /* OKKLineMinVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OKKLineMinVC.swift; sourceTree = "<group>"; };
006D8FCE20625C17008168AA /* CCKlineVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CCKlineVC.swift; sourceTree = "<group>"; };
009ECEDD204FC8F200558BC0 /* CCSQLiteData.sqlite-shm */ = {isa = PBXFileReference; lastKnownFileType = file; path = "CCSQLiteData.sqlite-shm"; sourceTree = "<group>"; };
009ECEDE204FC8F200558BC0 /* CCSQLiteData.sqlite-wal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "CCSQLiteData.sqlite-wal"; sourceTree = "<group>"; };
B94ED120A65D5F5E76115D4C /* Pods-OKKLineMin.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OKKLineMin.debug.xcconfig"; path = "Pods/Target Support Files/Pods-OKKLineMin/Pods-OKKLineMin.debug.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -121,6 +123,7 @@
0012EE042019C45200EEED92 /* LaunchScreen.storyboard */,
0012EE072019C45200EEED92 /* Info.plist */,
0012EE492019C56F00EEED92 /* OKKLineMin-Bridging-Header.h */,
006D8FCE20625C17008168AA /* CCKlineVC.swift */,
);
path = OKKLineMin;
sourceTree = "<group>";
Expand Down Expand Up @@ -398,6 +401,7 @@
0012EE8A2019C78700EEED92 /* OKKLineMinVC.swift in Sources */,
0012EE842019C6F600EEED92 /* OKKLineDrawView.swift in Sources */,
0012EE572019C5CB00EEED92 /* CCSQLiteData.m in Sources */,
006D8FCF20625C17008168AA /* CCKlineVC.swift in Sources */,
0012EE7F2019C6F600EEED92 /* OKKLineModel.swift in Sources */,
0012EE7B2019C6F600EEED92 /* OKKDJModel.swift in Sources */,
0012EE822019C6F600EEED92 /* OKKLineAccessoryView.swift in Sources */,
Expand Down
50 changes: 45 additions & 5 deletions OKKLineMin/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,31 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="3dp-nS-tmG">
<rect key="frame" x="137.5" y="308.5" width="100" height="50"/>
<rect key="frame" x="88" y="308.5" width="200" height="50"/>
<constraints>
<constraint firstAttribute="width" constant="100" id="EnY-4S-f5A"/>
<constraint firstAttribute="width" constant="200" id="EnY-4S-f5A"/>
<constraint firstAttribute="height" constant="50" id="eGU-Ui-lY8"/>
</constraints>
<state key="normal" title="OKKLineMin"/>
<state key="normal" title="OKKLineMin Full"/>
<connections>
<segue destination="71J-Yr-dKi" kind="presentation" id="2c8-lf-cd7"/>
<segue destination="71J-Yr-dKi" kind="presentation" id="HtS-6M-Jqf"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="lKi-g6-Sfe">
<rect key="frame" x="88" y="408.5" width="200" height="50"/>
<state key="normal" title="OKKLineMin Half"/>
<connections>
<segue destination="g0H-98-Tuw" kind="presentation" id="1xt-oj-BBS"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="1" green="0.90937095438229265" blue="0.33234092962868356" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="lKi-g6-Sfe" firstAttribute="centerX" secondItem="3dp-nS-tmG" secondAttribute="centerX" id="DqX-bq-VBo"/>
<constraint firstItem="lKi-g6-Sfe" firstAttribute="top" secondItem="3dp-nS-tmG" secondAttribute="bottom" constant="50" id="Edr-N0-eEO"/>
<constraint firstItem="3dp-nS-tmG" firstAttribute="centerY" secondItem="8bC-Xf-vdC" secondAttribute="centerY" id="ZLN-pR-YJp"/>
<constraint firstItem="lKi-g6-Sfe" firstAttribute="width" secondItem="3dp-nS-tmG" secondAttribute="width" id="qsA-XB-bw0"/>
<constraint firstItem="lKi-g6-Sfe" firstAttribute="height" secondItem="3dp-nS-tmG" secondAttribute="height" id="t4d-GG-y6c"/>
<constraint firstItem="3dp-nS-tmG" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="xqk-cf-ccu"/>
</constraints>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
Expand Down Expand Up @@ -69,7 +80,36 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="zUN-ah-eEZ" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="548" y="45"/>
<point key="canvasLocation" x="609" y="-355"/>
</scene>
<!--KlineVC-->
<scene sceneID="PQm-8u-taF">
<objects>
<viewController id="g0H-98-Tuw" customClass="CCKlineVC" customModule="OKKLineMin" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="3Vc-Ye-JI9">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="n92-1Q-1LE">
<rect key="frame" x="0.0" y="20" width="375" height="647"/>
<color key="backgroundColor" red="0.98431372549999996" green="0.35686274509999999" blue="0.23137254900000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</subviews>
<constraints>
<constraint firstItem="n92-1Q-1LE" firstAttribute="leading" secondItem="qiX-go-WEM" secondAttribute="leading" id="1Um-lC-kzK"/>
<constraint firstItem="n92-1Q-1LE" firstAttribute="top" secondItem="qiX-go-WEM" secondAttribute="top" id="4hI-ef-HjA"/>
<constraint firstItem="qiX-go-WEM" firstAttribute="trailing" secondItem="n92-1Q-1LE" secondAttribute="trailing" id="9tT-Zc-glt"/>
<constraint firstItem="qiX-go-WEM" firstAttribute="bottom" secondItem="n92-1Q-1LE" secondAttribute="bottom" id="qpu-lJ-Vok"/>
</constraints>
<viewLayoutGuide key="safeArea" id="qiX-go-WEM"/>
</view>
<connections>
<outlet property="backgroundView" destination="n92-1Q-1LE" id="yMt-fV-AXa"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="NfK-RD-kuI" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="610" y="313"/>
</scene>
</scenes>
</document>
83 changes: 83 additions & 0 deletions OKKLineMin/CCKlineVC.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
//
// CCHalfVC.swift
// OKKLineMin
//
// Created by dengyouhua on 21/03/2018.
// Copyright © 2018 cc | ccworld1000@gmail.com. All rights reserved.
// https://github.com/ccworld1000/OKKLineMin
//

import UIKit

class CCKlineVC: UIViewController {

@IBOutlet weak var backgroundView: UIView!
var klineView: OKKLineView!
var backButton: UIButton!;

// var isFull : Bool

override func viewDidLoad() {
super.viewDidLoad()

loadingUI()
sqliteHandle()
}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
UIApplication.shared.isStatusBarHidden = true
}

override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
UIApplication.shared.isStatusBarHidden = false
}

override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return .portrait
}

@objc func backHandle(button: UIButton) {
dismiss(animated: true, completion: nil)
}

func loadingUI() {
self.view.backgroundColor = OKConfiguration.sharedConfiguration.main.backgroundColor
klineView = OKKLineView()
backgroundView.addSubview(self.klineView)
klineView.snp.makeConstraints { (make) in
make.edges.equalToSuperview()
}

backButton = UIButton(type: .custom)
backButton.setTitle("Back", for: .normal)
backButton.titleLabel?.font = UIFont.systemFont(size: 12)
backButton.backgroundColor = UIColor.blue
backButton.addTarget(self, action:#selector(backHandle(button:)) , for: .touchUpInside)

self.backgroundView.addSubview(backButton)
backButton.snp.makeConstraints { (make) in
make.top.equalToSuperview()
make.left.equalToSuperview()
make.size.equalTo(CGSize(width: 50, height: 20))
}
}

func sqliteHandle() {
if let list = CCSQLiteData.readDefaultDataList() {
let datas = list as! [[Double]]

var dataArray = [OKKLineModel]()
for data in datas {
let model = OKKLineModel(date: data[0], open: data[1], close: data[4], high: data[2], low: data[3], volume: data[5])
dataArray.append(model)
}

self.klineView.drawKLineView(klineModels: dataArray)
}
}

}


0 comments on commit ed395f9

Please sign in to comment.