-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac634dc
commit ed395f9
Showing
3 changed files
with
132 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} | ||
|
||
} | ||
|
||
|