├── .gitattributes ├── .gitignore ├── LICENSE ├── Podfile ├── Podfile.lock ├── Pods ├── FHHFPSIndicator │ ├── FHHFPSIndicator │ │ ├── FHHFPSIndicator.h │ │ ├── FHHFPSIndicator.m │ │ ├── UIWindow+FHH.h │ │ └── UIWindow+FHH.m │ ├── LICENSE │ └── README.md ├── Headers │ ├── Private │ │ ├── FHHFPSIndicator │ │ │ ├── FHHFPSIndicator.h │ │ │ └── UIWindow+FHH.h │ │ ├── KVOController │ │ │ ├── FBKVOController.h │ │ │ ├── KVOController.h │ │ │ └── NSObject+FBKVOController.h │ │ └── Masonry │ │ │ ├── MASCompositeConstraint.h │ │ │ ├── MASConstraint+Private.h │ │ │ ├── MASConstraint.h │ │ │ ├── MASConstraintMaker.h │ │ │ ├── MASLayoutConstraint.h │ │ │ ├── MASUtilities.h │ │ │ ├── MASViewAttribute.h │ │ │ ├── MASViewConstraint.h │ │ │ ├── Masonry.h │ │ │ ├── NSArray+MASAdditions.h │ │ │ ├── NSArray+MASShorthandAdditions.h │ │ │ ├── NSLayoutConstraint+MASDebugAdditions.h │ │ │ ├── View+MASAdditions.h │ │ │ ├── View+MASShorthandAdditions.h │ │ │ └── ViewController+MASAdditions.h │ └── Public │ │ ├── FHHFPSIndicator │ │ ├── FHHFPSIndicator.h │ │ └── UIWindow+FHH.h │ │ ├── KVOController │ │ ├── FBKVOController.h │ │ ├── KVOController.h │ │ └── NSObject+FBKVOController.h │ │ └── Masonry │ │ ├── MASCompositeConstraint.h │ │ ├── MASConstraint+Private.h │ │ ├── MASConstraint.h │ │ ├── MASConstraintMaker.h │ │ ├── MASLayoutConstraint.h │ │ ├── MASUtilities.h │ │ ├── MASViewAttribute.h │ │ ├── MASViewConstraint.h │ │ ├── Masonry.h │ │ ├── NSArray+MASAdditions.h │ │ ├── NSArray+MASShorthandAdditions.h │ │ ├── NSLayoutConstraint+MASDebugAdditions.h │ │ ├── View+MASAdditions.h │ │ ├── View+MASShorthandAdditions.h │ │ └── ViewController+MASAdditions.h ├── KVOController │ ├── FBKVOController │ │ ├── FBKVOController.h │ │ ├── FBKVOController.m │ │ ├── KVOController.h │ │ ├── NSObject+FBKVOController.h │ │ └── NSObject+FBKVOController.m │ ├── LICENSE │ └── README.md ├── Manifest.lock ├── Masonry │ ├── LICENSE │ ├── Masonry │ │ ├── MASCompositeConstraint.h │ │ ├── MASCompositeConstraint.m │ │ ├── MASConstraint+Private.h │ │ ├── MASConstraint.h │ │ ├── MASConstraint.m │ │ ├── MASConstraintMaker.h │ │ ├── MASConstraintMaker.m │ │ ├── MASLayoutConstraint.h │ │ ├── MASLayoutConstraint.m │ │ ├── MASUtilities.h │ │ ├── MASViewAttribute.h │ │ ├── MASViewAttribute.m │ │ ├── MASViewConstraint.h │ │ ├── MASViewConstraint.m │ │ ├── Masonry.h │ │ ├── NSArray+MASAdditions.h │ │ ├── NSArray+MASAdditions.m │ │ ├── NSArray+MASShorthandAdditions.h │ │ ├── NSLayoutConstraint+MASDebugAdditions.h │ │ ├── NSLayoutConstraint+MASDebugAdditions.m │ │ ├── View+MASAdditions.h │ │ ├── View+MASAdditions.m │ │ ├── View+MASShorthandAdditions.h │ │ ├── ViewController+MASAdditions.h │ │ └── ViewController+MASAdditions.m │ └── README.md ├── Pods.xcodeproj │ ├── project.pbxproj │ └── xcuserdata │ │ └── zyw.xcuserdatad │ │ └── xcschemes │ │ ├── FHHFPSIndicator.xcscheme │ │ ├── KVOController.xcscheme │ │ ├── Masonry.xcscheme │ │ ├── Pods-ZYWChart.xcscheme │ │ └── xcschememanagement.plist └── Target Support Files │ ├── FHHFPSIndicator │ ├── FHHFPSIndicator-dummy.m │ ├── FHHFPSIndicator-prefix.pch │ └── FHHFPSIndicator.xcconfig │ ├── KVOController │ ├── KVOController-dummy.m │ ├── KVOController-prefix.pch │ └── KVOController.xcconfig │ ├── Masonry │ ├── Masonry-dummy.m │ ├── Masonry-prefix.pch │ └── Masonry.xcconfig │ └── Pods-ZYWChart │ ├── Pods-ZYWChart-acknowledgements.markdown │ ├── Pods-ZYWChart-acknowledgements.plist │ ├── Pods-ZYWChart-dummy.m │ ├── Pods-ZYWChart-frameworks.sh │ ├── Pods-ZYWChart-resources.sh │ ├── Pods-ZYWChart.debug.xcconfig │ └── Pods-ZYWChart.release.xcconfig ├── README.md ├── ZYWChart.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── zyw.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── ZYWChart.xcscheme │ └── xcschememanagement.plist ├── ZYWChart.xcworkspace ├── contents.xcworkspacedata ├── xcshareddata │ └── IDEWorkspaceChecks.plist └── xcuserdata │ └── zyw.xcuserdatad │ └── xcdebugger │ └── Breakpoints_v2.xcbkptlist ├── ZYWChart ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── 股票图标iPhoneApp_60pt@2x.png │ │ ├── 股票图标iPhoneApp_60pt@3x.png │ │ ├── 股票图标iPhoneNotification_20pt@2x.png │ │ ├── 股票图标iPhoneNotification_20pt@3x.png │ │ ├── 股票图标iPhoneSpootlight5_29pt@2x.png │ │ ├── 股票图标iPhoneSpootlight5_29pt@3x.png │ │ ├── 股票图标iPhoneSpootlight7_40pt@2x.png │ │ └── 股票图标iPhoneSpootlight7_40pt@3x.png │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── BaseNavigationController.h ├── BaseNavigationController.m ├── Category │ ├── UIBezierPath+Draw.h │ ├── UIBezierPath+Draw.m │ ├── UIColor+YW.h │ ├── UIColor+YW.m │ ├── UIView+Extension.h │ └── UIView+Extension.m ├── Controller │ ├── CandleCrossScreenVC.h │ ├── CandleCrossScreenVC.m │ ├── CandleLineVC.h │ ├── CandleLineVC.m │ ├── LineVC.h │ ├── LineVC.m │ ├── SlipLineVC.h │ ├── SlipLineVC.m │ ├── TimeLineVC.h │ └── TimeLineVC.m ├── Help │ ├── ZYWCalcuteTool.h │ ├── ZYWCalcuteTool.m │ ├── ZYWCalcuteUntil.h │ └── ZYWCalcuteUntil.m ├── Info.plist ├── Model │ ├── ZYWCandleModel.h │ ├── ZYWCandleModel.m │ ├── ZYWCandlePostionModel.h │ ├── ZYWCandlePostionModel.m │ ├── ZYWLineData.h │ ├── ZYWLineData.m │ ├── ZYWLineModel.h │ ├── ZYWLineModel.m │ ├── ZYWLineUntil.h │ ├── ZYWLineUntil.m │ ├── ZYWMacdModel.h │ ├── ZYWMacdModel.m │ ├── ZYWMacdPostionModel.h │ ├── ZYWMacdPostionModel.m │ ├── ZYWTimeLineModel.h │ └── ZYWTimeLineModel.m ├── N225.xml ├── PriceView │ ├── ZYWCrossPriceView.h │ ├── ZYWCrossPriceView.m │ ├── ZYWPriceView.h │ ├── ZYWPriceView.m │ ├── ZYWQuotaView.h │ └── ZYWQuotaView.m ├── View │ ├── ZYWBaseChartView.h │ ├── ZYWBaseChartView.m │ ├── ZYWCandleChartView.h │ ├── ZYWCandleChartView.m │ ├── ZYWCandleProtocol.h │ ├── ZYWKdjLineView.h │ ├── ZYWKdjLineView.m │ ├── ZYWLineView.h │ ├── ZYWLineView.m │ ├── ZYWMacdView.h │ ├── ZYWMacdView.m │ ├── ZYWSlipLineView.h │ ├── ZYWSlipLineView.m │ ├── ZYWTecnnicalView.h │ ├── ZYWTecnnicalView.m │ ├── ZYWTimeLineView.h │ ├── ZYWTimeLineView.m │ ├── ZYWWrLineView.h │ └── ZYWWrLineView.m ├── ViewController.h ├── ViewController.m ├── ZYWChart-Prefix.pch ├── data.plist ├── main.m └── thridPart │ └── TALib │ ├── include │ ├── ta_abstract.h │ ├── ta_common.h │ ├── ta_defs.h │ ├── ta_func.h │ └── ta_libc.h │ └── src │ ├── ta_common │ ├── ta_global.c │ ├── ta_global.h │ ├── ta_magic_nb.h │ ├── ta_memory.h │ ├── ta_pragma.h │ ├── ta_retcode.c │ ├── ta_retcode.csv │ └── ta_version.c │ └── ta_func │ ├── ta_ACOS.c │ ├── ta_AD.c │ ├── ta_ADD.c │ ├── ta_ADOSC.c │ ├── ta_ADX.c │ ├── ta_ADXR.c │ ├── ta_APO.c │ ├── ta_AROON.c │ ├── ta_AROONOSC.c │ ├── ta_ASIN.c │ ├── ta_ATAN.c │ ├── ta_ATR.c │ ├── ta_AVGPRICE.c │ ├── ta_BBANDS.c │ ├── ta_BETA.c │ ├── ta_BOP.c │ ├── ta_CCI.c │ ├── ta_CDL2CROWS.c │ ├── ta_CDL3BLACKCROWS.c │ ├── ta_CDL3INSIDE.c │ ├── ta_CDL3LINESTRIKE.c │ ├── ta_CDL3OUTSIDE.c │ ├── ta_CDL3STARSINSOUTH.c │ ├── ta_CDL3WHITESOLDIERS.c │ ├── ta_CDLABANDONEDBABY.c │ ├── ta_CDLADVANCEBLOCK.c │ ├── ta_CDLBELTHOLD.c │ ├── ta_CDLBREAKAWAY.c │ ├── ta_CDLCLOSINGMARUBOZU.c │ ├── ta_CDLCONCEALBABYSWALL.c │ ├── ta_CDLCOUNTERATTACK.c │ ├── ta_CDLDARKCLOUDCOVER.c │ ├── ta_CDLDOJI.c │ ├── ta_CDLDOJISTAR.c │ ├── ta_CDLDRAGONFLYDOJI.c │ ├── ta_CDLENGULFING.c │ ├── ta_CDLEVENINGDOJISTAR.c │ ├── ta_CDLEVENINGSTAR.c │ ├── ta_CDLGAPSIDESIDEWHITE.c │ ├── ta_CDLGRAVESTONEDOJI.c │ ├── ta_CDLHAMMER.c │ ├── ta_CDLHANGINGMAN.c │ ├── ta_CDLHARAMI.c │ ├── ta_CDLHARAMICROSS.c │ ├── ta_CDLHIGHWAVE.c │ ├── ta_CDLHIKKAKE.c │ ├── ta_CDLHIKKAKEMOD.c │ ├── ta_CDLHOMINGPIGEON.c │ ├── ta_CDLIDENTICAL3CROWS.c │ ├── ta_CDLINNECK.c │ ├── ta_CDLINVERTEDHAMMER.c │ ├── ta_CDLKICKING.c │ ├── ta_CDLKICKINGBYLENGTH.c │ ├── ta_CDLLADDERBOTTOM.c │ ├── ta_CDLLONGLEGGEDDOJI.c │ ├── ta_CDLLONGLINE.c │ ├── ta_CDLMARUBOZU.c │ ├── ta_CDLMATCHINGLOW.c │ ├── ta_CDLMATHOLD.c │ ├── ta_CDLMORNINGDOJISTAR.c │ ├── ta_CDLMORNINGSTAR.c │ ├── ta_CDLONNECK.c │ ├── ta_CDLPIERCING.c │ ├── ta_CDLRICKSHAWMAN.c │ ├── ta_CDLRISEFALL3METHODS.c │ ├── ta_CDLSEPARATINGLINES.c │ ├── ta_CDLSHOOTINGSTAR.c │ ├── ta_CDLSHORTLINE.c │ ├── ta_CDLSPINNINGTOP.c │ ├── ta_CDLSTALLEDPATTERN.c │ ├── ta_CDLSTICKSANDWICH.c │ ├── ta_CDLTAKURI.c │ ├── ta_CDLTASUKIGAP.c │ ├── ta_CDLTHRUSTING.c │ ├── ta_CDLTRISTAR.c │ ├── ta_CDLUNIQUE3RIVER.c │ ├── ta_CDLUPSIDEGAP2CROWS.c │ ├── ta_CDLXSIDEGAP3METHODS.c │ ├── ta_CEIL.c │ ├── ta_CMO.c │ ├── ta_CORREL.c │ ├── ta_COS.c │ ├── ta_COSH.c │ ├── ta_DEMA.c │ ├── ta_DIV.c │ ├── ta_DX.c │ ├── ta_EMA.c │ ├── ta_EXP.c │ ├── ta_FLOOR.c │ ├── ta_HT_DCPERIOD.c │ ├── ta_HT_DCPHASE.c │ ├── ta_HT_PHASOR.c │ ├── ta_HT_SINE.c │ ├── ta_HT_TRENDLINE.c │ ├── ta_HT_TRENDMODE.c │ ├── ta_KAMA.c │ ├── ta_LINEARREG.c │ ├── ta_LINEARREG_ANGLE.c │ ├── ta_LINEARREG_INTERCEPT.c │ ├── ta_LINEARREG_SLOPE.c │ ├── ta_LN.c │ ├── ta_LOG10.c │ ├── ta_MA.c │ ├── ta_MACD.c │ ├── ta_MACDEXT.c │ ├── ta_MACDFIX.c │ ├── ta_MAMA.c │ ├── ta_MAVP.c │ ├── ta_MAX.c │ ├── ta_MAXINDEX.c │ ├── ta_MEDPRICE.c │ ├── ta_MFI.c │ ├── ta_MIDPOINT.c │ ├── ta_MIDPRICE.c │ ├── ta_MIN.c │ ├── ta_MININDEX.c │ ├── ta_MINMAX.c │ ├── ta_MINMAXINDEX.c │ ├── ta_MINUS_DI.c │ ├── ta_MINUS_DM.c │ ├── ta_MOM.c │ ├── ta_MULT.c │ ├── ta_NATR.c │ ├── ta_NVI.c │ ├── ta_OBV.c │ ├── ta_PLUS_DI.c │ ├── ta_PLUS_DM.c │ ├── ta_PPO.c │ ├── ta_PVI.c │ ├── ta_ROC.c │ ├── ta_ROCP.c │ ├── ta_ROCR.c │ ├── ta_ROCR100.c │ ├── ta_RSI.c │ ├── ta_SAR.c │ ├── ta_SAREXT.c │ ├── ta_SIN.c │ ├── ta_SINH.c │ ├── ta_SMA.c │ ├── ta_SQRT.c │ ├── ta_STDDEV.c │ ├── ta_STOCH.c │ ├── ta_STOCHF.c │ ├── ta_STOCHRSI.c │ ├── ta_SUB.c │ ├── ta_SUM.c │ ├── ta_T3.c │ ├── ta_TAN.c │ ├── ta_TANH.c │ ├── ta_TEMA.c │ ├── ta_TRANGE.c │ ├── ta_TRIMA.c │ ├── ta_TRIX.c │ ├── ta_TSF.c │ ├── ta_TYPPRICE.c │ ├── ta_ULTOSC.c │ ├── ta_VAR.c │ ├── ta_WCLPRICE.c │ ├── ta_WILLR.c │ ├── ta_WMA.c │ ├── ta_utility.c │ └── ta_utility.h ├── ZYWChartTests ├── Info.plist └── ZYWChartTests.m ├── ZYWChartUITests ├── Info.plist └── ZYWChartUITests.m └── resourse ├── demo1.gif ├── demo2.gif ├── demo3.gif ├── demo4.gif ├── demo5.gif ├── demo6.gif ├── img1.png └── img2.png /.gitattributes: -------------------------------------------------------------------------------- 1 | *.c linguist-language=objective-c 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | # Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | 55 | #Code Injection 56 | # 57 | # After new code Injection tools there's a generated folder /iOSInjectionProject 58 | # https://github.com/johnno1962/injectionforxcode 59 | 60 | iOSInjectionProject/ 61 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | platform :ios,'7.0' 2 | target "ZYWChart" do 3 | 4 | pod 'Masonry' 5 | pod 'KVOController' 6 | pod 'FHHFPSIndicator' 7 | end 8 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - FHHFPSIndicator (1.0.0) 3 | - KVOController (1.2.0) 4 | - Masonry (1.0.2) 5 | 6 | DEPENDENCIES: 7 | - FHHFPSIndicator 8 | - KVOController 9 | - Masonry 10 | 11 | SPEC REPOS: 12 | https://github.com/CocoaPods/Specs.git: 13 | - FHHFPSIndicator 14 | - KVOController 15 | - Masonry 16 | 17 | SPEC CHECKSUMS: 18 | FHHFPSIndicator: b4d34c3a93b702ad18358a4eb49839f83f4f30fb 19 | KVOController: d72ace34afea42468329623b3379ab3cd1d286b6 20 | Masonry: 7c429b56da9d4ee0bbb3ed77a5ea710d6a5df39e 21 | 22 | PODFILE CHECKSUM: 2644af91a9c289ad64191429137f117a1ce0470b 23 | 24 | COCOAPODS: 1.5.0 25 | -------------------------------------------------------------------------------- /Pods/FHHFPSIndicator/FHHFPSIndicator/FHHFPSIndicator.h: -------------------------------------------------------------------------------- 1 | // 2 | // FHHFPSIndicator.h 3 | // FHHFPSIndicator:https://github.com/jvjishou/FHHFPSIndicator 4 | // 5 | // Created by 002 on 16/6/27. 6 | // Copyright © 2016年 002. All rights reserved. 7 | // 8 | // This source code is licensed under the MIT-style license found in the 9 | // LICENSE file in the root directory of this source tree. 10 | // 11 | 12 | #import 13 | #import 14 | #import "UIWindow+FHH.h" 15 | 16 | 17 | // FpsLabel's position. Default is FPSIndicatorPositionBottomCenter 18 | // If your device is iPhone4's or iPhone5's series,use FPSIndicatorPositionBottomCenter to make the fpsLabel show completed. 19 | typedef enum { 20 | FPSIndicatorPositionTopLeft, /// 10 | 11 | @interface UIWindow (FHH) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Pods/FHHFPSIndicator/FHHFPSIndicator/UIWindow+FHH.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIWindow+FHH.m 3 | // FHHFPSIndicator 4 | // 5 | // Created by 002 on 16/6/27. 6 | // Copyright © 2016年 002. All rights reserved. 7 | // 8 | 9 | #import "UIWindow+FHH.h" 10 | 11 | #define TAG_fpsLabel 110213 12 | 13 | @implementation UIWindow (FHH) 14 | 15 | - (void)layoutSubviews { 16 | 17 | [super layoutSubviews]; 18 | 19 | for (UIView *label in self.subviews) { 20 | if ([label isKindOfClass:[UILabel class]]&& label.tag == TAG_fpsLabel) { 21 | [self bringSubviewToFront:label]; 22 | return; 23 | } 24 | } 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Pods/FHHFPSIndicator/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 jvjishou 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Pods/FHHFPSIndicator/README.md: -------------------------------------------------------------------------------- 1 | # FHHFPSIndicator 2 | 3 | Installation 4 | ============== 5 | ### CocoaPods【使用CocoaPods】 6 | 7 | 1. Add `pod "FHHFPSIndicator"` to your Podfile. 8 | 2. Run `pod install` or `pod update`. 9 | 3. Import \. 10 | 11 | ### Manually【手动导入】 12 | 1. Drag all source files under floder `FHHFPSIndicator` to your project.【将`FHHFPSIndicator`文件夹中的所有源代码拽入项目中】 13 | 2. Import the main header file:`#import "FHHFPSIndicator.h"`【导入主头文件:`#import "FHHFPSIndicator.h"`】 14 | 15 | ###Instruction 16 | you shoud call `[FHHFPSIndicator sharedFPSIndicator] show]` after the keyWindw becomes keyAndVisible;【在[window makeKeyAndVisible]之后调用`[FHHFPSIndicator sharedFPSIndicator]`】 17 | 18 | Advice:Use FHHFPSIndicator in DEBUG mode【建议在DEBUG模式下使用】 19 | 20 | 21 | Demo Project 22 | ============== 23 | See `Demo/FHHFPSIndicatorDemo` 24 | 25 | add the code in AppDelegate.m 26 | 27 |
28 | #if defined(DEBUG) || defined(_DEBUG)
29 | #import "FHHFPSIndicator.h"
30 | #endif
31 | 
32 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
33 |     // Override point for customization after application launch.
34 |     
35 |     self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
36 |     [self.window makeKeyAndVisible];
37 |     
38 |     // add the follwing code after the window become keyAndVisible
39 |     #if defined(DEBUG) || defined(_DEBUG)
40 |         [[FHHFPSIndicator sharedFPSIndicator] show];
41 | //        [FHHFPSIndicator sharedFPSIndicator].fpsLabelPosition = FPSIndicatorPositionTopRight;
42 |     #endif
43 |     
44 |     self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:[[HomeViewController alloc] init]];
45 |     
46 |     return YES;
47 | }
48 | 
49 | 
50 | 51 |
52 | 53 |
54 | 55 |
56 | 57 |
58 | 59 | License 60 | ============== 61 | FHHFPSIndicator is provided under the MIT license. See LICENSE file for details. -------------------------------------------------------------------------------- /Pods/Headers/Private/FHHFPSIndicator/FHHFPSIndicator.h: -------------------------------------------------------------------------------- 1 | ../../../FHHFPSIndicator/FHHFPSIndicator/FHHFPSIndicator.h -------------------------------------------------------------------------------- /Pods/Headers/Private/FHHFPSIndicator/UIWindow+FHH.h: -------------------------------------------------------------------------------- 1 | ../../../FHHFPSIndicator/FHHFPSIndicator/UIWindow+FHH.h -------------------------------------------------------------------------------- /Pods/Headers/Private/KVOController/FBKVOController.h: -------------------------------------------------------------------------------- 1 | ../../../KVOController/FBKVOController/FBKVOController.h -------------------------------------------------------------------------------- /Pods/Headers/Private/KVOController/KVOController.h: -------------------------------------------------------------------------------- 1 | ../../../KVOController/FBKVOController/KVOController.h -------------------------------------------------------------------------------- /Pods/Headers/Private/KVOController/NSObject+FBKVOController.h: -------------------------------------------------------------------------------- 1 | ../../../KVOController/FBKVOController/NSObject+FBKVOController.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASCompositeConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASCompositeConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASConstraint+Private.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASConstraint+Private.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASConstraintMaker.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASConstraintMaker.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASLayoutConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASLayoutConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASUtilities.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASUtilities.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASViewAttribute.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASViewAttribute.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASViewConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASViewConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/Masonry.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/Masonry.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/NSArray+MASAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/NSArray+MASAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/NSArray+MASShorthandAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/NSArray+MASShorthandAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/NSLayoutConstraint+MASDebugAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/NSLayoutConstraint+MASDebugAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/View+MASAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/View+MASAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/View+MASShorthandAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/View+MASShorthandAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/ViewController+MASAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/ViewController+MASAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/FHHFPSIndicator/FHHFPSIndicator.h: -------------------------------------------------------------------------------- 1 | ../../../FHHFPSIndicator/FHHFPSIndicator/FHHFPSIndicator.h -------------------------------------------------------------------------------- /Pods/Headers/Public/FHHFPSIndicator/UIWindow+FHH.h: -------------------------------------------------------------------------------- 1 | ../../../FHHFPSIndicator/FHHFPSIndicator/UIWindow+FHH.h -------------------------------------------------------------------------------- /Pods/Headers/Public/KVOController/FBKVOController.h: -------------------------------------------------------------------------------- 1 | ../../../KVOController/FBKVOController/FBKVOController.h -------------------------------------------------------------------------------- /Pods/Headers/Public/KVOController/KVOController.h: -------------------------------------------------------------------------------- 1 | ../../../KVOController/FBKVOController/KVOController.h -------------------------------------------------------------------------------- /Pods/Headers/Public/KVOController/NSObject+FBKVOController.h: -------------------------------------------------------------------------------- 1 | ../../../KVOController/FBKVOController/NSObject+FBKVOController.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASCompositeConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASCompositeConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASConstraint+Private.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASConstraint+Private.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASConstraintMaker.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASConstraintMaker.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASLayoutConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASLayoutConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASUtilities.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASUtilities.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASViewAttribute.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASViewAttribute.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASViewConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASViewConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/Masonry.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/Masonry.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/NSArray+MASAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/NSArray+MASAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/NSArray+MASShorthandAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/NSArray+MASShorthandAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/NSLayoutConstraint+MASDebugAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/NSLayoutConstraint+MASDebugAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/View+MASAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/View+MASAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/View+MASShorthandAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/View+MASShorthandAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/ViewController+MASAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/ViewController+MASAdditions.h -------------------------------------------------------------------------------- /Pods/KVOController/FBKVOController/KVOController.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import 12 | -------------------------------------------------------------------------------- /Pods/KVOController/FBKVOController/NSObject+FBKVOController.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "FBKVOController.h" 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | /** 17 | Category that adds built-in `KVOController` and `KVOControllerNonRetaining` on any instance of `NSObject`. 18 | 19 | This makes it convenient to simply create and forget a `FBKVOController`, 20 | and when this object gets dealloc'd, so will the associated controller and the observation info. 21 | */ 22 | @interface NSObject (FBKVOController) 23 | 24 | /** 25 | @abstract Lazy-loaded FBKVOController for use with any object 26 | @return FBKVOController associated with this object, creating one if necessary 27 | @discussion This makes it convenient to simply create and forget a FBKVOController, and when this object gets dealloc'd, so will the associated controller and the observation info. 28 | */ 29 | @property (nonatomic, strong) FBKVOController *KVOController; 30 | 31 | /** 32 | @abstract Lazy-loaded FBKVOController for use with any object 33 | @return FBKVOController associated with this object, creating one if necessary 34 | @discussion This makes it convenient to simply create and forget a FBKVOController. 35 | Use this version when a strong reference between controller and observed object would create a retain cycle. 36 | When not retaining observed objects, special care must be taken to remove observation info prior to deallocation of the observed object. 37 | */ 38 | @property (nonatomic, strong) FBKVOController *KVOControllerNonRetaining; 39 | 40 | @end 41 | 42 | NS_ASSUME_NONNULL_END 43 | -------------------------------------------------------------------------------- /Pods/KVOController/FBKVOController/NSObject+FBKVOController.m: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2014-present, Facebook, Inc. 3 | All rights reserved. 4 | 5 | This source code is licensed under the BSD-style license found in the 6 | LICENSE file in the root directory of this source tree. An additional grant 7 | of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "NSObject+FBKVOController.h" 11 | 12 | #import 13 | 14 | #if !__has_feature(objc_arc) 15 | #error This file must be compiled with ARC. Convert your project to ARC or specify the -fobjc-arc flag. 16 | #endif 17 | 18 | #pragma mark NSObject Category - 19 | 20 | NS_ASSUME_NONNULL_BEGIN 21 | 22 | static void *NSObjectKVOControllerKey = &NSObjectKVOControllerKey; 23 | static void *NSObjectKVOControllerNonRetainingKey = &NSObjectKVOControllerNonRetainingKey; 24 | 25 | @implementation NSObject (FBKVOController) 26 | 27 | - (FBKVOController *)KVOController 28 | { 29 | id controller = objc_getAssociatedObject(self, NSObjectKVOControllerKey); 30 | 31 | // lazily create the KVOController 32 | if (nil == controller) { 33 | controller = [FBKVOController controllerWithObserver:self]; 34 | self.KVOController = controller; 35 | } 36 | 37 | return controller; 38 | } 39 | 40 | - (void)setKVOController:(FBKVOController *)KVOController 41 | { 42 | objc_setAssociatedObject(self, NSObjectKVOControllerKey, KVOController, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 43 | } 44 | 45 | - (FBKVOController *)KVOControllerNonRetaining 46 | { 47 | id controller = objc_getAssociatedObject(self, NSObjectKVOControllerNonRetainingKey); 48 | 49 | if (nil == controller) { 50 | controller = [[FBKVOController alloc] initWithObserver:self retainObserved:NO]; 51 | self.KVOControllerNonRetaining = controller; 52 | } 53 | 54 | return controller; 55 | } 56 | 57 | - (void)setKVOControllerNonRetaining:(FBKVOController *)KVOControllerNonRetaining 58 | { 59 | objc_setAssociatedObject(self, NSObjectKVOControllerNonRetainingKey, KVOControllerNonRetaining, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 60 | } 61 | 62 | @end 63 | 64 | 65 | NS_ASSUME_NONNULL_END 66 | -------------------------------------------------------------------------------- /Pods/KVOController/LICENSE: -------------------------------------------------------------------------------- 1 | BSD License 2 | 3 | For KVOController software 4 | 5 | Copyright (c) 2014, Facebook, Inc. All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | 17 | * Neither the name Facebook nor the names of its contributors may be used to 18 | endorse or promote products derived from this software without specific 19 | prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 22 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 25 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 28 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /Pods/KVOController/README.md: -------------------------------------------------------------------------------- 1 | # [KVOController](https://github.com/facebook/KVOController) 2 | [![Build Status](https://img.shields.io/travis/facebook/KVOController/master.svg?style=flat)](https://travis-ci.org/facebook/KVOController) 3 | [![Coverage Status](https://img.shields.io/codecov/c/github/facebook/KVOController/master.svg)](https://codecov.io/github/facebook/KVOController) 4 | [![Version](https://img.shields.io/cocoapods/v/KVOController.svg?style=flat)](http://cocoadocs.org/docsets/KVOController) 5 | [![Platform](https://img.shields.io/cocoapods/p/KVOController.svg?style=flat)](http://cocoadocs.org/docsets/KVOController) 6 | 7 | Key-value observing is a particularly useful technique for communicating between layers in a Model-View-Controller application. KVOController builds on Cocoa's time-tested key-value observing implementation. It offers a simple, modern API, that is also thread safe. Benefits include: 8 | 9 | - Notification using blocks, custom actions, or NSKeyValueObserving callback. 10 | - No exceptions on observer removal. 11 | - Implicit observer removal on controller dealloc. 12 | - Thread-safety with special guards against observer resurrection – [rdar://15985376](http://openradar.appspot.com/radar?id=5305010728468480). 13 | 14 | For more information on KVO, see Apple's [Introduction to Key-Value Observing](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/KeyValueObserving/KeyValueObserving.html). 15 | 16 | ## Usage 17 | 18 | Example apps for iOS and OS X are included with the project. Here is one simple usage pattern: 19 | 20 | ```objective-c 21 | // create KVO controller with observer 22 | FBKVOController *KVOController = [FBKVOController controllerWithObserver:self]; 23 | self.KVOController = KVOController; 24 | 25 | // observe clock date property 26 | [self.KVOController observe:clock keyPath:@"date" options:NSKeyValueObservingOptionInitial|NSKeyValueObservingOptionNew block:^(ClockView *clockView, Clock *clock, NSDictionary *change) { 27 | 28 | // update clock view with new value 29 | clockView.date = change[NSKeyValueChangeNewKey]; 30 | }]; 31 | ``` 32 | 33 | While simple, the above example is complete. A clock view creates a KVO controller to observe the clock date property. A block callback is used to handle initial and change notification. Unobservation happens implicitly on controller deallocation, since a strong reference to the `KVOController` is kept. 34 | 35 | Note: the observer specified must support weak references. The zeroing weak reference guards against notification of a deallocated observer instance. 36 | 37 | #### NSObject Category 38 | For an even easier usage, just `#import ` for an automatic `KVOController` property on all objects. 39 | 40 | ```objc 41 | [self.KVOController observe:clock keyPath:@"date" options:NSKeyValueObservingOptionInitial|NSKeyValueObservingOptionNew action:@selector(updateClockWithDateChange:)]; 42 | ``` 43 | 44 | ## Prerequisites 45 | 46 | KVOController takes advantage of recent Objective-C runtime advances, including ARC and weak collections. It requires: 47 | 48 | - iOS 6 or later. 49 | - OS X 10.7 or later. 50 | 51 | ## Installation 52 | 53 | To install using [CocoaPods](https://github.com/cocoapods/cocoapods), add the following to your project Podfile: 54 | 55 | ```ruby 56 | pod 'KVOController' 57 | ``` 58 | 59 | To install using [Carthage](https://github.com/carthage/carthage), add the following to your project Cartfile: 60 | 61 | ``` 62 | github "facebook/KVOController" 63 | ``` 64 | 65 | Alternatively, drag and drop FBKVOController.h and FBKVOController.m into your Xcode project, agreeing to copy files if needed. For iOS applications, you can choose to link against the static library target of the KVOController project. 66 | 67 | Having installed using CocoaPods or Carthage, add the following to import in Objective-C: 68 | ```objective-c 69 | #import 70 | ``` 71 | 72 | ## Testing 73 | 74 | The unit tests included use CocoaPods for managing dependencies. Install CocoaPods if you haven't already done so. Then, at the command line, navigate to the root KVOController directory and type: 75 | 76 | ```sh 77 | pod install 78 | ``` 79 | 80 | This will install and add test dependencies on OCHamcrest and OCMockito. Re-open the Xcode KVOController workspace and Test, ⌘U. 81 | 82 | ## License 83 | 84 | KVOController is released under a BSD License. See LICENSE file for details. 85 | -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - FHHFPSIndicator (1.0.0) 3 | - KVOController (1.2.0) 4 | - Masonry (1.0.2) 5 | 6 | DEPENDENCIES: 7 | - FHHFPSIndicator 8 | - KVOController 9 | - Masonry 10 | 11 | SPEC REPOS: 12 | https://github.com/CocoaPods/Specs.git: 13 | - FHHFPSIndicator 14 | - KVOController 15 | - Masonry 16 | 17 | SPEC CHECKSUMS: 18 | FHHFPSIndicator: b4d34c3a93b702ad18358a4eb49839f83f4f30fb 19 | KVOController: d72ace34afea42468329623b3379ab3cd1d286b6 20 | Masonry: 7c429b56da9d4ee0bbb3ed77a5ea710d6a5df39e 21 | 22 | PODFILE CHECKSUM: 2644af91a9c289ad64191429137f117a1ce0470b 23 | 24 | COCOAPODS: 1.5.0 25 | -------------------------------------------------------------------------------- /Pods/Masonry/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2012 Masonry Team - https://github.com/Masonry 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASCompositeConstraint.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASCompositeConstraint.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 21/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASConstraint.h" 10 | #import "MASUtilities.h" 11 | 12 | /** 13 | * A group of MASConstraint objects 14 | */ 15 | @interface MASCompositeConstraint : MASConstraint 16 | 17 | /** 18 | * Creates a composite with a predefined array of children 19 | * 20 | * @param children child MASConstraints 21 | * 22 | * @return a composite constraint 23 | */ 24 | - (id)initWithChildren:(NSArray *)children; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASCompositeConstraint.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASCompositeConstraint.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 21/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASCompositeConstraint.h" 10 | #import "MASConstraint+Private.h" 11 | 12 | @interface MASCompositeConstraint () 13 | 14 | @property (nonatomic, strong) id mas_key; 15 | @property (nonatomic, strong) NSMutableArray *childConstraints; 16 | 17 | @end 18 | 19 | @implementation MASCompositeConstraint 20 | 21 | - (id)initWithChildren:(NSArray *)children { 22 | self = [super init]; 23 | if (!self) return nil; 24 | 25 | _childConstraints = [children mutableCopy]; 26 | for (MASConstraint *constraint in _childConstraints) { 27 | constraint.delegate = self; 28 | } 29 | 30 | return self; 31 | } 32 | 33 | #pragma mark - MASConstraintDelegate 34 | 35 | - (void)constraint:(MASConstraint *)constraint shouldBeReplacedWithConstraint:(MASConstraint *)replacementConstraint { 36 | NSUInteger index = [self.childConstraints indexOfObject:constraint]; 37 | NSAssert(index != NSNotFound, @"Could not find constraint %@", constraint); 38 | [self.childConstraints replaceObjectAtIndex:index withObject:replacementConstraint]; 39 | } 40 | 41 | - (MASConstraint *)constraint:(MASConstraint __unused *)constraint addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute { 42 | id strongDelegate = self.delegate; 43 | MASConstraint *newConstraint = [strongDelegate constraint:self addConstraintWithLayoutAttribute:layoutAttribute]; 44 | newConstraint.delegate = self; 45 | [self.childConstraints addObject:newConstraint]; 46 | return newConstraint; 47 | } 48 | 49 | #pragma mark - NSLayoutConstraint multiplier proxies 50 | 51 | - (MASConstraint * (^)(CGFloat))multipliedBy { 52 | return ^id(CGFloat multiplier) { 53 | for (MASConstraint *constraint in self.childConstraints) { 54 | constraint.multipliedBy(multiplier); 55 | } 56 | return self; 57 | }; 58 | } 59 | 60 | - (MASConstraint * (^)(CGFloat))dividedBy { 61 | return ^id(CGFloat divider) { 62 | for (MASConstraint *constraint in self.childConstraints) { 63 | constraint.dividedBy(divider); 64 | } 65 | return self; 66 | }; 67 | } 68 | 69 | #pragma mark - MASLayoutPriority proxy 70 | 71 | - (MASConstraint * (^)(MASLayoutPriority))priority { 72 | return ^id(MASLayoutPriority priority) { 73 | for (MASConstraint *constraint in self.childConstraints) { 74 | constraint.priority(priority); 75 | } 76 | return self; 77 | }; 78 | } 79 | 80 | #pragma mark - NSLayoutRelation proxy 81 | 82 | - (MASConstraint * (^)(id, NSLayoutRelation))equalToWithRelation { 83 | return ^id(id attr, NSLayoutRelation relation) { 84 | for (MASConstraint *constraint in self.childConstraints.copy) { 85 | constraint.equalToWithRelation(attr, relation); 86 | } 87 | return self; 88 | }; 89 | } 90 | 91 | #pragma mark - attribute chaining 92 | 93 | - (MASConstraint *)addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute { 94 | [self constraint:self addConstraintWithLayoutAttribute:layoutAttribute]; 95 | return self; 96 | } 97 | 98 | #pragma mark - Animator proxy 99 | 100 | #if TARGET_OS_MAC && !(TARGET_OS_IPHONE || TARGET_OS_TV) 101 | 102 | - (MASConstraint *)animator { 103 | for (MASConstraint *constraint in self.childConstraints) { 104 | [constraint animator]; 105 | } 106 | return self; 107 | } 108 | 109 | #endif 110 | 111 | #pragma mark - debug helpers 112 | 113 | - (MASConstraint * (^)(id))key { 114 | return ^id(id key) { 115 | self.mas_key = key; 116 | int i = 0; 117 | for (MASConstraint *constraint in self.childConstraints) { 118 | constraint.key([NSString stringWithFormat:@"%@[%d]", key, i++]); 119 | } 120 | return self; 121 | }; 122 | } 123 | 124 | #pragma mark - NSLayoutConstraint constant setters 125 | 126 | - (void)setInsets:(MASEdgeInsets)insets { 127 | for (MASConstraint *constraint in self.childConstraints) { 128 | constraint.insets = insets; 129 | } 130 | } 131 | 132 | - (void)setOffset:(CGFloat)offset { 133 | for (MASConstraint *constraint in self.childConstraints) { 134 | constraint.offset = offset; 135 | } 136 | } 137 | 138 | - (void)setSizeOffset:(CGSize)sizeOffset { 139 | for (MASConstraint *constraint in self.childConstraints) { 140 | constraint.sizeOffset = sizeOffset; 141 | } 142 | } 143 | 144 | - (void)setCenterOffset:(CGPoint)centerOffset { 145 | for (MASConstraint *constraint in self.childConstraints) { 146 | constraint.centerOffset = centerOffset; 147 | } 148 | } 149 | 150 | #pragma mark - MASConstraint 151 | 152 | - (void)activate { 153 | for (MASConstraint *constraint in self.childConstraints) { 154 | [constraint activate]; 155 | } 156 | } 157 | 158 | - (void)deactivate { 159 | for (MASConstraint *constraint in self.childConstraints) { 160 | [constraint deactivate]; 161 | } 162 | } 163 | 164 | - (void)install { 165 | for (MASConstraint *constraint in self.childConstraints) { 166 | constraint.updateExisting = self.updateExisting; 167 | [constraint install]; 168 | } 169 | } 170 | 171 | - (void)uninstall { 172 | for (MASConstraint *constraint in self.childConstraints) { 173 | [constraint uninstall]; 174 | } 175 | } 176 | 177 | @end 178 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASConstraint+Private.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASConstraint+Private.h 3 | // Masonry 4 | // 5 | // Created by Nick Tymchenko on 29/04/14. 6 | // Copyright (c) 2014 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASConstraint.h" 10 | 11 | @protocol MASConstraintDelegate; 12 | 13 | 14 | @interface MASConstraint () 15 | 16 | /** 17 | * Whether or not to check for an existing constraint instead of adding constraint 18 | */ 19 | @property (nonatomic, assign) BOOL updateExisting; 20 | 21 | /** 22 | * Usually MASConstraintMaker but could be a parent MASConstraint 23 | */ 24 | @property (nonatomic, weak) id delegate; 25 | 26 | /** 27 | * Based on a provided value type, is equal to calling: 28 | * NSNumber - setOffset: 29 | * NSValue with CGPoint - setPointOffset: 30 | * NSValue with CGSize - setSizeOffset: 31 | * NSValue with MASEdgeInsets - setInsets: 32 | */ 33 | - (void)setLayoutConstantWithValue:(NSValue *)value; 34 | 35 | @end 36 | 37 | 38 | @interface MASConstraint (Abstract) 39 | 40 | /** 41 | * Sets the constraint relation to given NSLayoutRelation 42 | * returns a block which accepts one of the following: 43 | * MASViewAttribute, UIView, NSValue, NSArray 44 | * see readme for more details. 45 | */ 46 | - (MASConstraint * (^)(id, NSLayoutRelation))equalToWithRelation; 47 | 48 | /** 49 | * Override to set a custom chaining behaviour 50 | */ 51 | - (MASConstraint *)addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute; 52 | 53 | @end 54 | 55 | 56 | @protocol MASConstraintDelegate 57 | 58 | /** 59 | * Notifies the delegate when the constraint needs to be replaced with another constraint. For example 60 | * A MASViewConstraint may turn into a MASCompositeConstraint when an array is passed to one of the equality blocks 61 | */ 62 | - (void)constraint:(MASConstraint *)constraint shouldBeReplacedWithConstraint:(MASConstraint *)replacementConstraint; 63 | 64 | - (MASConstraint *)constraint:(MASConstraint *)constraint addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute; 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASLayoutConstraint.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASLayoutConstraint.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 3/08/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASUtilities.h" 10 | 11 | /** 12 | * When you are debugging or printing the constraints attached to a view this subclass 13 | * makes it easier to identify which constraints have been created via Masonry 14 | */ 15 | @interface MASLayoutConstraint : NSLayoutConstraint 16 | 17 | /** 18 | * a key to associate with this constraint 19 | */ 20 | @property (nonatomic, strong) id mas_key; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASLayoutConstraint.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASLayoutConstraint.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 3/08/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASLayoutConstraint.h" 10 | 11 | @implementation MASLayoutConstraint 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASViewAttribute.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASAttribute.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 21/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASUtilities.h" 10 | 11 | /** 12 | * An immutable tuple which stores the view and the related NSLayoutAttribute. 13 | * Describes part of either the left or right hand side of a constraint equation 14 | */ 15 | @interface MASViewAttribute : NSObject 16 | 17 | /** 18 | * The view which the reciever relates to. Can be nil if item is not a view. 19 | */ 20 | @property (nonatomic, weak, readonly) MAS_VIEW *view; 21 | 22 | /** 23 | * The item which the reciever relates to. 24 | */ 25 | @property (nonatomic, weak, readonly) id item; 26 | 27 | /** 28 | * The attribute which the reciever relates to 29 | */ 30 | @property (nonatomic, assign, readonly) NSLayoutAttribute layoutAttribute; 31 | 32 | /** 33 | * Convenience initializer. 34 | */ 35 | - (id)initWithView:(MAS_VIEW *)view layoutAttribute:(NSLayoutAttribute)layoutAttribute; 36 | 37 | /** 38 | * The designated initializer. 39 | */ 40 | - (id)initWithView:(MAS_VIEW *)view item:(id)item layoutAttribute:(NSLayoutAttribute)layoutAttribute; 41 | 42 | /** 43 | * Determine whether the layoutAttribute is a size attribute 44 | * 45 | * @return YES if layoutAttribute is equal to NSLayoutAttributeWidth or NSLayoutAttributeHeight 46 | */ 47 | - (BOOL)isSizeAttribute; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASViewAttribute.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASAttribute.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 21/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASViewAttribute.h" 10 | 11 | @implementation MASViewAttribute 12 | 13 | - (id)initWithView:(MAS_VIEW *)view layoutAttribute:(NSLayoutAttribute)layoutAttribute { 14 | self = [self initWithView:view item:view layoutAttribute:layoutAttribute]; 15 | return self; 16 | } 17 | 18 | - (id)initWithView:(MAS_VIEW *)view item:(id)item layoutAttribute:(NSLayoutAttribute)layoutAttribute { 19 | self = [super init]; 20 | if (!self) return nil; 21 | 22 | _view = view; 23 | _item = item; 24 | _layoutAttribute = layoutAttribute; 25 | 26 | return self; 27 | } 28 | 29 | - (BOOL)isSizeAttribute { 30 | return self.layoutAttribute == NSLayoutAttributeWidth 31 | || self.layoutAttribute == NSLayoutAttributeHeight; 32 | } 33 | 34 | - (BOOL)isEqual:(MASViewAttribute *)viewAttribute { 35 | if ([viewAttribute isKindOfClass:self.class]) { 36 | return self.view == viewAttribute.view 37 | && self.layoutAttribute == viewAttribute.layoutAttribute; 38 | } 39 | return [super isEqual:viewAttribute]; 40 | } 41 | 42 | - (NSUInteger)hash { 43 | return MAS_NSUINTROTATE([self.view hash], MAS_NSUINT_BIT / 2) ^ self.layoutAttribute; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASViewConstraint.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASConstraint.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 20/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASViewAttribute.h" 10 | #import "MASConstraint.h" 11 | #import "MASLayoutConstraint.h" 12 | #import "MASUtilities.h" 13 | 14 | /** 15 | * A single constraint. 16 | * Contains the attributes neccessary for creating a NSLayoutConstraint and adding it to the appropriate view 17 | */ 18 | @interface MASViewConstraint : MASConstraint 19 | 20 | /** 21 | * First item/view and first attribute of the NSLayoutConstraint 22 | */ 23 | @property (nonatomic, strong, readonly) MASViewAttribute *firstViewAttribute; 24 | 25 | /** 26 | * Second item/view and second attribute of the NSLayoutConstraint 27 | */ 28 | @property (nonatomic, strong, readonly) MASViewAttribute *secondViewAttribute; 29 | 30 | /** 31 | * initialises the MASViewConstraint with the first part of the equation 32 | * 33 | * @param firstViewAttribute view.mas_left, view.mas_width etc. 34 | * 35 | * @return a new view constraint 36 | */ 37 | - (id)initWithFirstViewAttribute:(MASViewAttribute *)firstViewAttribute; 38 | 39 | /** 40 | * Returns all MASViewConstraints installed with this view as a first item. 41 | * 42 | * @param view A view to retrieve constraints for. 43 | * 44 | * @return An array of MASViewConstraints. 45 | */ 46 | + (NSArray *)installedConstraintsForView:(MAS_VIEW *)view; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/Masonry.h: -------------------------------------------------------------------------------- 1 | // 2 | // Masonry.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 20/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for Masonry. 12 | FOUNDATION_EXPORT double MasonryVersionNumber; 13 | 14 | //! Project version string for Masonry. 15 | FOUNDATION_EXPORT const unsigned char MasonryVersionString[]; 16 | 17 | #import "MASUtilities.h" 18 | #import "View+MASAdditions.h" 19 | #import "View+MASShorthandAdditions.h" 20 | #import "ViewController+MASAdditions.h" 21 | #import "NSArray+MASAdditions.h" 22 | #import "NSArray+MASShorthandAdditions.h" 23 | #import "MASConstraint.h" 24 | #import "MASCompositeConstraint.h" 25 | #import "MASViewAttribute.h" 26 | #import "MASViewConstraint.h" 27 | #import "MASConstraintMaker.h" 28 | #import "MASLayoutConstraint.h" 29 | #import "NSLayoutConstraint+MASDebugAdditions.h" 30 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/NSArray+MASAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+MASAdditions.h 3 | // 4 | // 5 | // Created by Daniel Hammond on 11/26/13. 6 | // 7 | // 8 | 9 | #import "MASUtilities.h" 10 | #import "MASConstraintMaker.h" 11 | #import "MASViewAttribute.h" 12 | 13 | typedef NS_ENUM(NSUInteger, MASAxisType) { 14 | MASAxisTypeHorizontal, 15 | MASAxisTypeVertical 16 | }; 17 | 18 | @interface NSArray (MASAdditions) 19 | 20 | /** 21 | * Creates a MASConstraintMaker with each view in the callee. 22 | * Any constraints defined are added to the view or the appropriate superview once the block has finished executing on each view 23 | * 24 | * @param block scope within which you can build up the constraints which you wish to apply to each view. 25 | * 26 | * @return Array of created MASConstraints 27 | */ 28 | - (NSArray *)mas_makeConstraints:(void (^)(MASConstraintMaker *make))block; 29 | 30 | /** 31 | * Creates a MASConstraintMaker with each view in the callee. 32 | * Any constraints defined are added to each view or the appropriate superview once the block has finished executing on each view. 33 | * If an existing constraint exists then it will be updated instead. 34 | * 35 | * @param block scope within which you can build up the constraints which you wish to apply to each view. 36 | * 37 | * @return Array of created/updated MASConstraints 38 | */ 39 | - (NSArray *)mas_updateConstraints:(void (^)(MASConstraintMaker *make))block; 40 | 41 | /** 42 | * Creates a MASConstraintMaker with each view in the callee. 43 | * Any constraints defined are added to each view or the appropriate superview once the block has finished executing on each view. 44 | * All constraints previously installed for the views will be removed. 45 | * 46 | * @param block scope within which you can build up the constraints which you wish to apply to each view. 47 | * 48 | * @return Array of created/updated MASConstraints 49 | */ 50 | - (NSArray *)mas_remakeConstraints:(void (^)(MASConstraintMaker *make))block; 51 | 52 | /** 53 | * distribute with fixed spacing 54 | * 55 | * @param axisType which axis to distribute items along 56 | * @param fixedSpacing the spacing between each item 57 | * @param leadSpacing the spacing before the first item and the container 58 | * @param tailSpacing the spacing after the last item and the container 59 | */ 60 | - (void)mas_distributeViewsAlongAxis:(MASAxisType)axisType withFixedSpacing:(CGFloat)fixedSpacing leadSpacing:(CGFloat)leadSpacing tailSpacing:(CGFloat)tailSpacing; 61 | 62 | /** 63 | * distribute with fixed item size 64 | * 65 | * @param axisType which axis to distribute items along 66 | * @param fixedItemLength the fixed length of each item 67 | * @param leadSpacing the spacing before the first item and the container 68 | * @param tailSpacing the spacing after the last item and the container 69 | */ 70 | - (void)mas_distributeViewsAlongAxis:(MASAxisType)axisType withFixedItemLength:(CGFloat)fixedItemLength leadSpacing:(CGFloat)leadSpacing tailSpacing:(CGFloat)tailSpacing; 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/NSArray+MASShorthandAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+MASShorthandAdditions.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 22/07/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "NSArray+MASAdditions.h" 10 | 11 | #ifdef MAS_SHORTHAND 12 | 13 | /** 14 | * Shorthand array additions without the 'mas_' prefixes, 15 | * only enabled if MAS_SHORTHAND is defined 16 | */ 17 | @interface NSArray (MASShorthandAdditions) 18 | 19 | - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *make))block; 20 | - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *make))block; 21 | - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *make))block; 22 | 23 | @end 24 | 25 | @implementation NSArray (MASShorthandAdditions) 26 | 27 | - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *))block { 28 | return [self mas_makeConstraints:block]; 29 | } 30 | 31 | - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *))block { 32 | return [self mas_updateConstraints:block]; 33 | } 34 | 35 | - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *))block { 36 | return [self mas_remakeConstraints:block]; 37 | } 38 | 39 | @end 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/NSLayoutConstraint+MASDebugAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSLayoutConstraint+MASDebugAdditions.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 3/08/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASUtilities.h" 10 | 11 | /** 12 | * makes debug and log output of NSLayoutConstraints more readable 13 | */ 14 | @interface NSLayoutConstraint (MASDebugAdditions) 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/View+MASAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+MASAdditions.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 20/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASUtilities.h" 10 | #import "MASConstraintMaker.h" 11 | #import "MASViewAttribute.h" 12 | 13 | /** 14 | * Provides constraint maker block 15 | * and convience methods for creating MASViewAttribute which are view + NSLayoutAttribute pairs 16 | */ 17 | @interface MAS_VIEW (MASAdditions) 18 | 19 | /** 20 | * following properties return a new MASViewAttribute with current view and appropriate NSLayoutAttribute 21 | */ 22 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_left; 23 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_top; 24 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_right; 25 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottom; 26 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_leading; 27 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_trailing; 28 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_width; 29 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_height; 30 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_centerX; 31 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_centerY; 32 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_baseline; 33 | @property (nonatomic, strong, readonly) MASViewAttribute *(^mas_attribute)(NSLayoutAttribute attr); 34 | 35 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) 36 | 37 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_firstBaseline; 38 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_lastBaseline; 39 | 40 | #endif 41 | 42 | #if TARGET_OS_IPHONE || TARGET_OS_TV 43 | 44 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_leftMargin; 45 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_rightMargin; 46 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_topMargin; 47 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomMargin; 48 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_leadingMargin; 49 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_trailingMargin; 50 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_centerXWithinMargins; 51 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_centerYWithinMargins; 52 | 53 | #endif 54 | 55 | /** 56 | * a key to associate with this view 57 | */ 58 | @property (nonatomic, strong) id mas_key; 59 | 60 | /** 61 | * Finds the closest common superview between this view and another view 62 | * 63 | * @param view other view 64 | * 65 | * @return returns nil if common superview could not be found 66 | */ 67 | - (instancetype)mas_closestCommonSuperview:(MAS_VIEW *)view; 68 | 69 | /** 70 | * Creates a MASConstraintMaker with the callee view. 71 | * Any constraints defined are added to the view or the appropriate superview once the block has finished executing 72 | * 73 | * @param block scope within which you can build up the constraints which you wish to apply to the view. 74 | * 75 | * @return Array of created MASConstraints 76 | */ 77 | - (NSArray *)mas_makeConstraints:(void(^)(MASConstraintMaker *make))block; 78 | 79 | /** 80 | * Creates a MASConstraintMaker with the callee view. 81 | * Any constraints defined are added to the view or the appropriate superview once the block has finished executing. 82 | * If an existing constraint exists then it will be updated instead. 83 | * 84 | * @param block scope within which you can build up the constraints which you wish to apply to the view. 85 | * 86 | * @return Array of created/updated MASConstraints 87 | */ 88 | - (NSArray *)mas_updateConstraints:(void(^)(MASConstraintMaker *make))block; 89 | 90 | /** 91 | * Creates a MASConstraintMaker with the callee view. 92 | * Any constraints defined are added to the view or the appropriate superview once the block has finished executing. 93 | * All constraints previously installed for the view will be removed. 94 | * 95 | * @param block scope within which you can build up the constraints which you wish to apply to the view. 96 | * 97 | * @return Array of created/updated MASConstraints 98 | */ 99 | - (NSArray *)mas_remakeConstraints:(void(^)(MASConstraintMaker *make))block; 100 | 101 | @end 102 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/View+MASShorthandAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+MASShorthandAdditions.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 22/07/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "View+MASAdditions.h" 10 | 11 | #ifdef MAS_SHORTHAND 12 | 13 | /** 14 | * Shorthand view additions without the 'mas_' prefixes, 15 | * only enabled if MAS_SHORTHAND is defined 16 | */ 17 | @interface MAS_VIEW (MASShorthandAdditions) 18 | 19 | @property (nonatomic, strong, readonly) MASViewAttribute *left; 20 | @property (nonatomic, strong, readonly) MASViewAttribute *top; 21 | @property (nonatomic, strong, readonly) MASViewAttribute *right; 22 | @property (nonatomic, strong, readonly) MASViewAttribute *bottom; 23 | @property (nonatomic, strong, readonly) MASViewAttribute *leading; 24 | @property (nonatomic, strong, readonly) MASViewAttribute *trailing; 25 | @property (nonatomic, strong, readonly) MASViewAttribute *width; 26 | @property (nonatomic, strong, readonly) MASViewAttribute *height; 27 | @property (nonatomic, strong, readonly) MASViewAttribute *centerX; 28 | @property (nonatomic, strong, readonly) MASViewAttribute *centerY; 29 | @property (nonatomic, strong, readonly) MASViewAttribute *baseline; 30 | @property (nonatomic, strong, readonly) MASViewAttribute *(^attribute)(NSLayoutAttribute attr); 31 | 32 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) 33 | 34 | @property (nonatomic, strong, readonly) MASViewAttribute *firstBaseline; 35 | @property (nonatomic, strong, readonly) MASViewAttribute *lastBaseline; 36 | 37 | #endif 38 | 39 | #if TARGET_OS_IPHONE || TARGET_OS_TV 40 | 41 | @property (nonatomic, strong, readonly) MASViewAttribute *leftMargin; 42 | @property (nonatomic, strong, readonly) MASViewAttribute *rightMargin; 43 | @property (nonatomic, strong, readonly) MASViewAttribute *topMargin; 44 | @property (nonatomic, strong, readonly) MASViewAttribute *bottomMargin; 45 | @property (nonatomic, strong, readonly) MASViewAttribute *leadingMargin; 46 | @property (nonatomic, strong, readonly) MASViewAttribute *trailingMargin; 47 | @property (nonatomic, strong, readonly) MASViewAttribute *centerXWithinMargins; 48 | @property (nonatomic, strong, readonly) MASViewAttribute *centerYWithinMargins; 49 | 50 | #endif 51 | 52 | - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *make))block; 53 | - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *make))block; 54 | - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *make))block; 55 | 56 | @end 57 | 58 | #define MAS_ATTR_FORWARD(attr) \ 59 | - (MASViewAttribute *)attr { \ 60 | return [self mas_##attr]; \ 61 | } 62 | 63 | @implementation MAS_VIEW (MASShorthandAdditions) 64 | 65 | MAS_ATTR_FORWARD(top); 66 | MAS_ATTR_FORWARD(left); 67 | MAS_ATTR_FORWARD(bottom); 68 | MAS_ATTR_FORWARD(right); 69 | MAS_ATTR_FORWARD(leading); 70 | MAS_ATTR_FORWARD(trailing); 71 | MAS_ATTR_FORWARD(width); 72 | MAS_ATTR_FORWARD(height); 73 | MAS_ATTR_FORWARD(centerX); 74 | MAS_ATTR_FORWARD(centerY); 75 | MAS_ATTR_FORWARD(baseline); 76 | 77 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) 78 | 79 | MAS_ATTR_FORWARD(firstBaseline); 80 | MAS_ATTR_FORWARD(lastBaseline); 81 | 82 | #endif 83 | 84 | #if TARGET_OS_IPHONE || TARGET_OS_TV 85 | 86 | MAS_ATTR_FORWARD(leftMargin); 87 | MAS_ATTR_FORWARD(rightMargin); 88 | MAS_ATTR_FORWARD(topMargin); 89 | MAS_ATTR_FORWARD(bottomMargin); 90 | MAS_ATTR_FORWARD(leadingMargin); 91 | MAS_ATTR_FORWARD(trailingMargin); 92 | MAS_ATTR_FORWARD(centerXWithinMargins); 93 | MAS_ATTR_FORWARD(centerYWithinMargins); 94 | 95 | #endif 96 | 97 | - (MASViewAttribute *(^)(NSLayoutAttribute))attribute { 98 | return [self mas_attribute]; 99 | } 100 | 101 | - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *))block { 102 | return [self mas_makeConstraints:block]; 103 | } 104 | 105 | - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *))block { 106 | return [self mas_updateConstraints:block]; 107 | } 108 | 109 | - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *))block { 110 | return [self mas_remakeConstraints:block]; 111 | } 112 | 113 | @end 114 | 115 | #endif 116 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/ViewController+MASAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+MASAdditions.h 3 | // Masonry 4 | // 5 | // Created by Craig Siemens on 2015-06-23. 6 | // 7 | // 8 | 9 | #import "MASUtilities.h" 10 | #import "MASConstraintMaker.h" 11 | #import "MASViewAttribute.h" 12 | 13 | #ifdef MAS_VIEW_CONTROLLER 14 | 15 | @interface MAS_VIEW_CONTROLLER (MASAdditions) 16 | 17 | /** 18 | * following properties return a new MASViewAttribute with appropriate UILayoutGuide and NSLayoutAttribute 19 | */ 20 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_topLayoutGuide; 21 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomLayoutGuide; 22 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_topLayoutGuideTop; 23 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_topLayoutGuideBottom; 24 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomLayoutGuideTop; 25 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomLayoutGuideBottom; 26 | 27 | 28 | @end 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/ViewController+MASAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+MASAdditions.m 3 | // Masonry 4 | // 5 | // Created by Craig Siemens on 2015-06-23. 6 | // 7 | // 8 | 9 | #import "ViewController+MASAdditions.h" 10 | 11 | #ifdef MAS_VIEW_CONTROLLER 12 | 13 | @implementation MAS_VIEW_CONTROLLER (MASAdditions) 14 | 15 | - (MASViewAttribute *)mas_topLayoutGuide { 16 | return [[MASViewAttribute alloc] initWithView:self.view item:self.topLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; 17 | } 18 | - (MASViewAttribute *)mas_topLayoutGuideTop { 19 | return [[MASViewAttribute alloc] initWithView:self.view item:self.topLayoutGuide layoutAttribute:NSLayoutAttributeTop]; 20 | } 21 | - (MASViewAttribute *)mas_topLayoutGuideBottom { 22 | return [[MASViewAttribute alloc] initWithView:self.view item:self.topLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; 23 | } 24 | 25 | - (MASViewAttribute *)mas_bottomLayoutGuide { 26 | return [[MASViewAttribute alloc] initWithView:self.view item:self.bottomLayoutGuide layoutAttribute:NSLayoutAttributeTop]; 27 | } 28 | - (MASViewAttribute *)mas_bottomLayoutGuideTop { 29 | return [[MASViewAttribute alloc] initWithView:self.view item:self.bottomLayoutGuide layoutAttribute:NSLayoutAttributeTop]; 30 | } 31 | - (MASViewAttribute *)mas_bottomLayoutGuideBottom { 32 | return [[MASViewAttribute alloc] initWithView:self.view item:self.bottomLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; 33 | } 34 | 35 | 36 | 37 | @end 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/zyw.xcuserdatad/xcschemes/FHHFPSIndicator.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/zyw.xcuserdatad/xcschemes/KVOController.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/zyw.xcuserdatad/xcschemes/Masonry.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/zyw.xcuserdatad/xcschemes/Pods-ZYWChart.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/zyw.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | FHHFPSIndicator.xcscheme 8 | 9 | isShown 10 | 11 | 12 | KVOController.xcscheme 13 | 14 | isShown 15 | 16 | 17 | Masonry.xcscheme 18 | 19 | isShown 20 | 21 | 22 | Pods-ZYWChart.xcscheme 23 | 24 | isShown 25 | 26 | 27 | 28 | SuppressBuildableAutocreation 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Pods/Target Support Files/FHHFPSIndicator/FHHFPSIndicator-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_FHHFPSIndicator : NSObject 3 | @end 4 | @implementation PodsDummy_FHHFPSIndicator 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/FHHFPSIndicator/FHHFPSIndicator-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/FHHFPSIndicator/FHHFPSIndicator.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/FHHFPSIndicator 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/FHHFPSIndicator" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/FHHFPSIndicator" 4 | OTHER_LDFLAGS = -framework "Foundation" -framework "UIKit" 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/FHHFPSIndicator 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | -------------------------------------------------------------------------------- /Pods/Target Support Files/KVOController/KVOController-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_KVOController : NSObject 3 | @end 4 | @implementation PodsDummy_KVOController 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/KVOController/KVOController-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/KVOController/KVOController.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/KVOController 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/KVOController" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/KVOController" 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/KVOController 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Masonry/Masonry-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Masonry : NSObject 3 | @end 4 | @implementation PodsDummy_Masonry 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Masonry/Masonry-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Masonry/Masonry.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Masonry 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Masonry" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Masonry" 4 | OTHER_LDFLAGS = -framework "Foundation" -framework "UIKit" 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/Masonry 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ZYWChart/Pods-ZYWChart-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## FHHFPSIndicator 5 | 6 | The MIT License (MIT) 7 | 8 | Copyright (c) 2016 jvjishou 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all 18 | copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | SOFTWARE. 27 | 28 | 29 | ## KVOController 30 | 31 | BSD License 32 | 33 | For KVOController software 34 | 35 | Copyright (c) 2014, Facebook, Inc. All rights reserved. 36 | 37 | Redistribution and use in source and binary forms, with or without modification, 38 | are permitted provided that the following conditions are met: 39 | 40 | * Redistributions of source code must retain the above copyright notice, this 41 | list of conditions and the following disclaimer. 42 | 43 | * Redistributions in binary form must reproduce the above copyright notice, 44 | this list of conditions and the following disclaimer in the documentation 45 | and/or other materials provided with the distribution. 46 | 47 | * Neither the name Facebook nor the names of its contributors may be used to 48 | endorse or promote products derived from this software without specific 49 | prior written permission. 50 | 51 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 52 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 53 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 54 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 55 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 56 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 57 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 58 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 59 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 60 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 61 | 62 | 63 | ## Masonry 64 | 65 | Copyright (c) 2011-2012 Masonry Team - https://github.com/Masonry 66 | 67 | Permission is hereby granted, free of charge, to any person obtaining a copy 68 | of this software and associated documentation files (the "Software"), to deal 69 | in the Software without restriction, including without limitation the rights 70 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 71 | copies of the Software, and to permit persons to whom the Software is 72 | furnished to do so, subject to the following conditions: 73 | 74 | The above copyright notice and this permission notice shall be included in 75 | all copies or substantial portions of the Software. 76 | 77 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 78 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 79 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 80 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 81 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 82 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 83 | THE SOFTWARE. 84 | Generated by CocoaPods - https://cocoapods.org 85 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ZYWChart/Pods-ZYWChart-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | The MIT License (MIT) 18 | 19 | Copyright (c) 2016 jvjishou 20 | 21 | Permission is hereby granted, free of charge, to any person obtaining a copy 22 | of this software and associated documentation files (the "Software"), to deal 23 | in the Software without restriction, including without limitation the rights 24 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25 | copies of the Software, and to permit persons to whom the Software is 26 | furnished to do so, subject to the following conditions: 27 | 28 | The above copyright notice and this permission notice shall be included in all 29 | copies or substantial portions of the Software. 30 | 31 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 32 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 33 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 34 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 35 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 36 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 37 | SOFTWARE. 38 | 39 | License 40 | MIT 41 | Title 42 | FHHFPSIndicator 43 | Type 44 | PSGroupSpecifier 45 | 46 | 47 | FooterText 48 | BSD License 49 | 50 | For KVOController software 51 | 52 | Copyright (c) 2014, Facebook, Inc. All rights reserved. 53 | 54 | Redistribution and use in source and binary forms, with or without modification, 55 | are permitted provided that the following conditions are met: 56 | 57 | * Redistributions of source code must retain the above copyright notice, this 58 | list of conditions and the following disclaimer. 59 | 60 | * Redistributions in binary form must reproduce the above copyright notice, 61 | this list of conditions and the following disclaimer in the documentation 62 | and/or other materials provided with the distribution. 63 | 64 | * Neither the name Facebook nor the names of its contributors may be used to 65 | endorse or promote products derived from this software without specific 66 | prior written permission. 67 | 68 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 69 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 70 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 71 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 72 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 73 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 74 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 75 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 76 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 77 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 78 | 79 | License 80 | BSD 81 | Title 82 | KVOController 83 | Type 84 | PSGroupSpecifier 85 | 86 | 87 | FooterText 88 | Copyright (c) 2011-2012 Masonry Team - https://github.com/Masonry 89 | 90 | Permission is hereby granted, free of charge, to any person obtaining a copy 91 | of this software and associated documentation files (the "Software"), to deal 92 | in the Software without restriction, including without limitation the rights 93 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 94 | copies of the Software, and to permit persons to whom the Software is 95 | furnished to do so, subject to the following conditions: 96 | 97 | The above copyright notice and this permission notice shall be included in 98 | all copies or substantial portions of the Software. 99 | 100 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 101 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 102 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 103 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 104 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 105 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 106 | THE SOFTWARE. 107 | License 108 | MIT 109 | Title 110 | Masonry 111 | Type 112 | PSGroupSpecifier 113 | 114 | 115 | FooterText 116 | Generated by CocoaPods - https://cocoapods.org 117 | Title 118 | 119 | Type 120 | PSGroupSpecifier 121 | 122 | 123 | StringsTable 124 | Acknowledgements 125 | Title 126 | Acknowledgements 127 | 128 | 129 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ZYWChart/Pods-ZYWChart-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_ZYWChart : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_ZYWChart 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ZYWChart/Pods-ZYWChart.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/FHHFPSIndicator" "${PODS_ROOT}/Headers/Public/KVOController" "${PODS_ROOT}/Headers/Public/Masonry" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/FHHFPSIndicator" "${PODS_CONFIGURATION_BUILD_DIR}/KVOController" "${PODS_CONFIGURATION_BUILD_DIR}/Masonry" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/FHHFPSIndicator" -isystem "${PODS_ROOT}/Headers/Public/KVOController" -isystem "${PODS_ROOT}/Headers/Public/Masonry" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"FHHFPSIndicator" -l"KVOController" -l"Masonry" -framework "Foundation" -framework "UIKit" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ZYWChart/Pods-ZYWChart.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/FHHFPSIndicator" "${PODS_ROOT}/Headers/Public/KVOController" "${PODS_ROOT}/Headers/Public/Masonry" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/FHHFPSIndicator" "${PODS_CONFIGURATION_BUILD_DIR}/KVOController" "${PODS_CONFIGURATION_BUILD_DIR}/Masonry" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/FHHFPSIndicator" -isystem "${PODS_ROOT}/Headers/Public/KVOController" -isystem "${PODS_ROOT}/Headers/Public/Masonry" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"FHHFPSIndicator" -l"KVOController" -l"Masonry" -framework "Foundation" -framework "UIKit" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ZYWStock 2 | [![Support](https://img.shields.io/badge/support-iOS7.0+-blue.svg?style=flat)]()   3 | [![Support](https://img.shields.io/badge/support-Autolayout-orange.svg?style=flatt)]()   4 | [![License Apache](https://img.shields.io/hexpm/l/plug.svg?style=flat)]()   5 | # 说明 6 | - ZYWStock是iOS下K线图的绘制库。支持放大缩小,长按高亮, 横竖屏切换。流畅丝滑~~~ 7 | - 如果刚好帮到了你,欢迎star or fork 😄 O(∩_∩)O~~ 😄 8 | ## 9 | - ![](https://github.com/zyw113/ZYWStock/blob/master/resourse/demo6.gif) 10 | - ![](https://github.com/zyw113/ZYWStock/blob/master/resourse/demo3.gif) 11 | - ![](https://github.com/zyw113/ZYWStock/blob/master/resourse/demo4.gif) 12 | - ![](https://github.com/zyw113/ZYWStock/blob/master/resourse/demo5.gif) 13 | - ![](https://github.com/zyw113/ZYWStock/blob/master/resourse/img1.png) 14 | ## 特点: 15 | - 采用 CAShapeLayer + UIBezierPath绘制,绘制效率高,占用内存低 16 | - 底层视图是UIScrollView,ScrollView上面添加一个View,所有的绘制在这个View上完成。体验流畅丝滑,FPS平均在55帧以上 17 | - 指标支持MACD、WR、KDJ。指标计算采用TALib,方便扩展 18 | ## 版本记录 19 | ### V0.1 20 | - 新增横竖屏切换 21 | ### V0.2 22 | - 新增分时图 23 | ### V0.3 24 | - 优化代码 25 | ### V1.0 26 | - 整体代码修正 27 | ## 代理方法 28 | ``` 29 | /** 30 | 取得当前屏幕内模型数组的开始下标以及个数 31 | 32 | @param leftPostion 当前屏幕最右边的位置 33 | @param index 下标 34 | @param count 个数 35 | */ 36 | - (void)displayScreenleftPostion:(CGFloat)leftPostion startIndex:(NSInteger)index count:(NSInteger)count; 37 | 38 | /** 39 | 长按手势获得当前k线下标以及模型 40 | 41 | @param kLineModeIndex 当前k线在可视范围数组的位置下标 42 | @param kLineModel k线模型 43 | */ 44 | - (void)longPressCandleViewWithIndex:(NSInteger)kLineModeIndex kLineModel:(ZYWCandleModel *)kLineModel; 45 | 46 | /** 47 | 返回当前屏幕最后一根k线模型 48 | 49 | @param kLineModel k线模型 50 | */ 51 | - (void)displayLastModel:(ZYWCandleModel *)kLineModel; 52 | 53 | /** 54 | 加载更多数据 55 | */ 56 | - (void)displayMoreData; 57 | ``` 58 | ### 基础属性方法 59 | ``` 60 | /** 61 | 数据源数组 在调用绘制方法之前设置 62 | */ 63 | @property (nonatomic,strong) NSMutableArray<__kindof ZYWCandleModel*> *dataArray; 64 | 65 | /** 66 | 当前屏幕范围内显示的k线模型数组 67 | */ 68 | @property (nonatomic,strong) NSMutableArray *currentDisplayArray; 69 | 70 | /** 71 | 当前屏幕范围内显示的k线位置数组 72 | */ 73 | @property (nonatomic,strong) NSMutableArray *currentPostionArray; 74 | 75 | /** 76 | 可视区域显示多少根k线 (如果数据源数组不足以占满屏幕,需要手动给定宽度) 77 | */ 78 | @property (nonatomic,assign) NSInteger displayCount; 79 | 80 | /** 81 | k线之间的距离 82 | */ 83 | @property (nonatomic,assign) CGFloat candleSpace; 84 | 85 | /** 86 | k线的宽度 根据每页k线的根数和k线之间的距离动态计算得出 87 | */ 88 | @property (nonatomic,assign) CGFloat candleWidth; 89 | 90 | /** 91 | k线最小高度 92 | */ 93 | @property (nonatomic,assign) CGFloat minHeight; 94 | 95 | /** 96 | 当前屏幕范围内绘制起点位置 97 | */ 98 | @property (nonatomic,assign) CGFloat leftPostion; 99 | 100 | /** 101 | 当前绘制的起始下标 102 | */ 103 | @property (nonatomic,assign) NSInteger currentStartIndex; 104 | 105 | /** 106 | 滑到最右侧的偏移量 107 | */ 108 | @property (nonatomic,assign) CGFloat previousOffsetX; 109 | 110 | /** 111 | 当前偏移量 112 | */ 113 | @property (nonatomic,assign) CGFloat contentOffset; 114 | 115 | /** 116 | kvoEnable 117 | */ 118 | @property (nonatomic,assign) BOOL kvoEnable; 119 | 120 | /** 121 | 代理 122 | */ 123 | @property (nonatomic,weak) id delegate; 124 | 125 | - (CGPoint)getLongPressModelPostionWithXPostion:(CGFloat)xPostion; 126 | 127 | /** 128 | 填充方法 129 | 130 | */ 131 | - (void)stockFill; 132 | 133 | /** 134 | 刷新右拉加载调用 135 | */ 136 | - (void)reload; 137 | 138 | /** 139 | 宽度计算 140 | */ 141 | - (void)calcuteCandleWidth; 142 | 143 | /** 144 | 更新宽度 145 | */ 146 | - (void)updateWidth; 147 | 148 | /** 149 | 绘制K线 150 | */ 151 | - (void)drawKLine; 152 | ``` 153 | ## Contact 154 | - 如果使用中发现问题欢迎添加 issue ,也欢迎 Pull request。 155 | - QQ群:640138789 156 | ## License 157 | ZYWStock is released under the [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0). 158 | 159 | Copyright 2017 zyw113 All rights reserved. 160 | 161 | Licensed under the Apache License, Version 2.0 (the "License"); 162 | you may not use this file except in compliance with the License. 163 | You may obtain a copy of the License at 164 | 165 | http://www.apache.org/licenses/LICENSE-2.0 166 | 167 | Unless required by applicable law or agreed to in writing, software 168 | distributed under the License is distributed on an "AS IS" BASIS, 169 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 170 | See the License for the specific language governing permissions and 171 | limitations under the License. 172 | ## 博客地址 173 | [简书](http://www.jianshu.com/u/0a68be3f5462) 174 | -------------------------------------------------------------------------------- /ZYWChart.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ZYWChart.xcodeproj/xcuserdata/zyw.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /ZYWChart.xcodeproj/xcuserdata/zyw.xcuserdatad/xcschemes/ZYWChart.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 34 | 40 | 41 | 42 | 44 | 50 | 51 | 52 | 53 | 54 | 60 | 61 | 62 | 63 | 64 | 65 | 76 | 78 | 84 | 85 | 86 | 87 | 88 | 89 | 95 | 97 | 103 | 104 | 105 | 106 | 108 | 109 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /ZYWChart.xcodeproj/xcuserdata/zyw.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ZYWChart.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4227877C1E04F18600DB5CEC 16 | 17 | primary 18 | 19 | 20 | 422787951E04F18600DB5CEC 21 | 22 | primary 23 | 24 | 25 | 422787A01E04F18600DB5CEC 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /ZYWChart.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ZYWChart.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ZYWChart.xcworkspace/xcuserdata/zyw.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /ZYWChart/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2016/12/17. 6 | // Copyright © 2016年 zyw113. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /ZYWChart/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2016/12/17. 6 | // Copyright © 2016年 zyw113. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "ViewController.h" 11 | #import "FHHFPSIndicator.h" 12 | #import "BaseNavigationController.h" 13 | @interface AppDelegate () 14 | 15 | @end 16 | 17 | @implementation AppDelegate 18 | 19 | 20 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 21 | // Override point for customization after application launch. 22 | 23 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 24 | self.window.backgroundColor = [UIColor whiteColor]; 25 | [self.window makeKeyAndVisible]; 26 | 27 | #if defined(DEBUG) || defined(_DEBUG) 28 | 29 | [[FHHFPSIndicator sharedFPSIndicator] show]; 30 | 31 | #endif 32 | 33 | ViewController *Controller = [[ViewController alloc] init]; 34 | BaseNavigationController *nav = [[BaseNavigationController alloc] initWithRootViewController:Controller]; 35 | self.window.rootViewController = nav; 36 | 37 | return YES; 38 | } 39 | 40 | - (void)applicationWillResignActive:(UIApplication *)application { 41 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 42 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 43 | } 44 | 45 | 46 | - (void)applicationDidEnterBackground:(UIApplication *)application { 47 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 48 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 49 | } 50 | 51 | 52 | - (void)applicationWillEnterForeground:(UIApplication *)application { 53 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 54 | } 55 | 56 | 57 | - (void)applicationDidBecomeActive:(UIApplication *)application { 58 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 59 | } 60 | 61 | 62 | - (void)applicationWillTerminate:(UIApplication *)application { 63 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 64 | } 65 | 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /ZYWChart/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "股票图标iPhoneNotification_20pt@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "股票图标iPhoneNotification_20pt@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "股票图标iPhoneSpootlight5_29pt@2x.png", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "股票图标iPhoneSpootlight5_29pt@3x.png", 25 | "scale" : "3x" 26 | }, 27 | { 28 | "size" : "40x40", 29 | "idiom" : "iphone", 30 | "filename" : "股票图标iPhoneSpootlight7_40pt@2x.png", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "股票图标iPhoneSpootlight7_40pt@3x.png", 37 | "scale" : "3x" 38 | }, 39 | { 40 | "size" : "60x60", 41 | "idiom" : "iphone", 42 | "filename" : "股票图标iPhoneApp_60pt@2x.png", 43 | "scale" : "2x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "股票图标iPhoneApp_60pt@3x.png", 49 | "scale" : "3x" 50 | }, 51 | { 52 | "idiom" : "ipad", 53 | "size" : "20x20", 54 | "scale" : "1x" 55 | }, 56 | { 57 | "idiom" : "ipad", 58 | "size" : "20x20", 59 | "scale" : "2x" 60 | }, 61 | { 62 | "idiom" : "ipad", 63 | "size" : "29x29", 64 | "scale" : "1x" 65 | }, 66 | { 67 | "idiom" : "ipad", 68 | "size" : "29x29", 69 | "scale" : "2x" 70 | }, 71 | { 72 | "idiom" : "ipad", 73 | "size" : "40x40", 74 | "scale" : "1x" 75 | }, 76 | { 77 | "idiom" : "ipad", 78 | "size" : "40x40", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "idiom" : "ipad", 83 | "size" : "76x76", 84 | "scale" : "1x" 85 | }, 86 | { 87 | "idiom" : "ipad", 88 | "size" : "76x76", 89 | "scale" : "2x" 90 | }, 91 | { 92 | "idiom" : "ipad", 93 | "size" : "83.5x83.5", 94 | "scale" : "2x" 95 | }, 96 | { 97 | "idiom" : "ios-marketing", 98 | "size" : "1024x1024", 99 | "scale" : "1x" 100 | } 101 | ], 102 | "info" : { 103 | "version" : 1, 104 | "author" : "xcode" 105 | } 106 | } -------------------------------------------------------------------------------- /ZYWChart/Assets.xcassets/AppIcon.appiconset/股票图标iPhoneApp_60pt@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zyw113/ZYWStock/9135b7ee174de2e2c2c5307c1dbea49da2889d12/ZYWChart/Assets.xcassets/AppIcon.appiconset/股票图标iPhoneApp_60pt@2x.png -------------------------------------------------------------------------------- /ZYWChart/Assets.xcassets/AppIcon.appiconset/股票图标iPhoneApp_60pt@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zyw113/ZYWStock/9135b7ee174de2e2c2c5307c1dbea49da2889d12/ZYWChart/Assets.xcassets/AppIcon.appiconset/股票图标iPhoneApp_60pt@3x.png -------------------------------------------------------------------------------- /ZYWChart/Assets.xcassets/AppIcon.appiconset/股票图标iPhoneNotification_20pt@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zyw113/ZYWStock/9135b7ee174de2e2c2c5307c1dbea49da2889d12/ZYWChart/Assets.xcassets/AppIcon.appiconset/股票图标iPhoneNotification_20pt@2x.png -------------------------------------------------------------------------------- /ZYWChart/Assets.xcassets/AppIcon.appiconset/股票图标iPhoneNotification_20pt@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zyw113/ZYWStock/9135b7ee174de2e2c2c5307c1dbea49da2889d12/ZYWChart/Assets.xcassets/AppIcon.appiconset/股票图标iPhoneNotification_20pt@3x.png -------------------------------------------------------------------------------- /ZYWChart/Assets.xcassets/AppIcon.appiconset/股票图标iPhoneSpootlight5_29pt@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zyw113/ZYWStock/9135b7ee174de2e2c2c5307c1dbea49da2889d12/ZYWChart/Assets.xcassets/AppIcon.appiconset/股票图标iPhoneSpootlight5_29pt@2x.png -------------------------------------------------------------------------------- /ZYWChart/Assets.xcassets/AppIcon.appiconset/股票图标iPhoneSpootlight5_29pt@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zyw113/ZYWStock/9135b7ee174de2e2c2c5307c1dbea49da2889d12/ZYWChart/Assets.xcassets/AppIcon.appiconset/股票图标iPhoneSpootlight5_29pt@3x.png -------------------------------------------------------------------------------- /ZYWChart/Assets.xcassets/AppIcon.appiconset/股票图标iPhoneSpootlight7_40pt@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zyw113/ZYWStock/9135b7ee174de2e2c2c5307c1dbea49da2889d12/ZYWChart/Assets.xcassets/AppIcon.appiconset/股票图标iPhoneSpootlight7_40pt@2x.png -------------------------------------------------------------------------------- /ZYWChart/Assets.xcassets/AppIcon.appiconset/股票图标iPhoneSpootlight7_40pt@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zyw113/ZYWStock/9135b7ee174de2e2c2c5307c1dbea49da2889d12/ZYWChart/Assets.xcassets/AppIcon.appiconset/股票图标iPhoneSpootlight7_40pt@3x.png -------------------------------------------------------------------------------- /ZYWChart/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /ZYWChart/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /ZYWChart/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ZYWChart/BaseNavigationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // BaseNavigationController.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/6/18. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface BaseNavigationController : UINavigationController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ZYWChart/BaseNavigationController.m: -------------------------------------------------------------------------------- 1 | // 2 | // BaseNavigationController.m 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/6/18. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import "BaseNavigationController.h" 10 | 11 | @interface BaseNavigationController () 12 | 13 | @end 14 | 15 | @implementation BaseNavigationController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | } 20 | 21 | - (BOOL)shouldAutorotate 22 | { 23 | return [[self.viewControllers lastObject] shouldAutorotate]; 24 | } 25 | 26 | - (UIInterfaceOrientationMask)supportedInterfaceOrientations 27 | { 28 | return [[self.viewControllers lastObject] supportedInterfaceOrientations]; 29 | } 30 | 31 | - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { 32 | return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation]; 33 | } 34 | 35 | - (void)didReceiveMemoryWarning { 36 | [super didReceiveMemoryWarning]; 37 | // Dispose of any resources that can be recreated. 38 | } 39 | 40 | /* 41 | #pragma mark - Navigation 42 | 43 | // In a storyboard-based application, you will often want to do a little preparation before navigation 44 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 45 | // Get the new view controller using [segue destinationViewController]. 46 | // Pass the selected object to the new view controller. 47 | } 48 | */ 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /ZYWChart/Category/UIBezierPath+Draw.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIBezierPath+Draw.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/4/8. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIBezierPath (Draw) 12 | 13 | /** 14 | 绘制单个折线 15 | 16 | @param linesArray 单个折线数组 17 | @return 绘制的path 18 | */ 19 | + (UIBezierPath*)drawLine:(NSMutableArray*)linesArray; 20 | 21 | /** 22 | 绘制多个折线 23 | 24 | @param linesArray 多个折线数组 25 | @return 绘制的path数组 26 | */ 27 | + (NSMutableArray<__kindof UIBezierPath*>*)drawLines:(NSMutableArray*)linesArray; 28 | 29 | /** 30 | 绘制蜡烛图 31 | 32 | @param open 开盘价 33 | @param close 收盘价 34 | @param high 最高价 35 | @param low 最低价 36 | @param candleWidth 蜡烛线宽度 37 | @param rect 绘制区域 38 | @param xPostion 绘制x坐标 39 | @param lineWidth 直线宽度 40 | @return 绘制的path 41 | */ 42 | + (UIBezierPath*)drawKLine:(CGFloat)open close:(CGFloat)close high:(CGFloat)high low:(CGFloat)low candleWidth:(CGFloat)candleWidth rect:(CGRect)rect xPostion:(CGFloat)xPostion lineWidth:(CGFloat)lineWidth; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /ZYWChart/Category/UIBezierPath+Draw.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIBezierPath+Draw.m 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/4/8. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import "UIBezierPath+Draw.h" 10 | 11 | @implementation UIBezierPath (Draw) 12 | 13 | + (UIBezierPath*)drawLine:(NSMutableArray*)linesArray 14 | { 15 | UIBezierPath *path = [UIBezierPath bezierPath]; 16 | [linesArray enumerateObjectsUsingBlock:^(ZYWLineModel* obj, NSUInteger idx, BOOL * _Nonnull stop) { 17 | if (idx == 0) 18 | { 19 | [path moveToPoint:CGPointMake(obj.xPosition,obj.yPosition)]; 20 | } 21 | 22 | else 23 | { 24 | [path addLineToPoint:CGPointMake(obj.xPosition,obj.yPosition)]; 25 | } 26 | }]; 27 | return path; 28 | } 29 | 30 | + (NSMutableArray<__kindof UIBezierPath*>*)drawLines:(NSMutableArray*)linesArray 31 | { 32 | NSAssert(0 != linesArray.count && NULL != linesArray, @"传入的数组为nil ,打印结果---->>%@",linesArray); 33 | 34 | NSMutableArray *resultArray = [NSMutableArray array]; 35 | for (NSMutableArray *lineArray in linesArray) 36 | { 37 | UIBezierPath *path = [UIBezierPath drawLine:lineArray]; 38 | [resultArray addObject:path]; 39 | } 40 | return resultArray; 41 | } 42 | 43 | + (UIBezierPath*)drawKLine:(CGFloat)open close:(CGFloat)close high:(CGFloat)high low:(CGFloat)low candleWidth:(CGFloat)candleWidth rect:(CGRect)rect xPostion:(CGFloat)xPostion lineWidth:(CGFloat)lineWidth 44 | { 45 | UIBezierPath *candlePath = [UIBezierPath bezierPathWithRect:rect]; 46 | candlePath.lineWidth = lineWidth; 47 | [candlePath moveToPoint:CGPointMake(xPostion+candleWidth/2-lineWidth/2, high)]; 48 | [candlePath addLineToPoint:CGPointMake(xPostion+candleWidth/2-lineWidth/2, low)]; 49 | return candlePath; 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /ZYWChart/Category/UIColor+YW.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor+YW.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/4/8. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIColor (YW) 12 | + (UIColor *)colorWithHexString:(NSString *)color; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /ZYWChart/Category/UIColor+YW.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor+YW.m 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/4/8. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import "UIColor+YW.h" 10 | 11 | @implementation UIColor (YW) 12 | 13 | + (UIColor *)colorWithHexString:(NSString *)color 14 | { 15 | NSString *cString = [[color stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString]; 16 | 17 | if ([cString length] < 6) { 18 | return [UIColor clearColor]; 19 | } 20 | 21 | if ([cString hasPrefix:@"0X"]) 22 | cString = [cString substringFromIndex:2]; 23 | if ([cString hasPrefix:@"#"]) 24 | cString = [cString substringFromIndex:1]; 25 | if ([cString length] != 6) 26 | return [UIColor clearColor]; 27 | 28 | NSRange range; 29 | range.location = 0; 30 | range.length = 2; 31 | 32 | //r 33 | NSString *rString = [cString substringWithRange:range]; 34 | 35 | //g 36 | range.location = 2; 37 | NSString *gString = [cString substringWithRange:range]; 38 | 39 | //b 40 | range.location = 4; 41 | NSString *bString = [cString substringWithRange:range]; 42 | 43 | unsigned int r, g, b; 44 | [[NSScanner scannerWithString:rString] scanHexInt:&r]; 45 | [[NSScanner scannerWithString:gString] scanHexInt:&g]; 46 | [[NSScanner scannerWithString:bString] scanHexInt:&b]; 47 | return [UIColor colorWithRed:((float) r / 255.0f) green:((float) g / 255.0f) blue:((float) b / 255.0f) alpha:1.0f]; 48 | } 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /ZYWChart/Category/UIView+Extension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+Extension.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/4/8. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIView (Extension) 12 | 13 | @property (nonatomic, assign) CGFloat x; 14 | @property (nonatomic, assign) CGFloat y; 15 | @property (nonatomic, assign) CGFloat centerX; 16 | @property (nonatomic, assign) CGFloat centerY; 17 | @property (nonatomic, assign) CGFloat width; 18 | @property (nonatomic, assign) CGFloat height; 19 | @property (nonatomic, assign) CGSize size; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /ZYWChart/Category/UIView+Extension.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+Extension.m 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/4/8. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import "UIView+Extension.h" 10 | 11 | @implementation UIView (Extension) 12 | 13 | -(void)setX:(CGFloat)x 14 | { 15 | CGRect tempF = self.frame; 16 | tempF.origin.x = x; 17 | self.frame = tempF; 18 | } 19 | 20 | -(CGFloat)x 21 | { 22 | return self.frame.origin.x; 23 | } 24 | 25 | -(void)setY:(CGFloat)y{ 26 | CGRect tempF = self.frame; 27 | tempF.origin.y = y ; 28 | self.frame = tempF; 29 | } 30 | 31 | -(CGFloat)y 32 | { 33 | return self.frame.origin.y; 34 | } 35 | 36 | -(void)setWidth:(CGFloat)width 37 | { 38 | CGRect tempF = self.frame; 39 | tempF.size.width = width; 40 | self.frame = tempF; 41 | } 42 | 43 | -(void)setCenterX:(CGFloat)centerX 44 | { 45 | CGPoint tempF = self.center; 46 | tempF.x = centerX; 47 | self.center = tempF; 48 | } 49 | -(CGFloat)centerX 50 | { 51 | return self.center.x; 52 | } 53 | 54 | -(void)setCenterY:(CGFloat)centerY 55 | { 56 | CGPoint tempF = self.center; 57 | tempF.y = centerY; 58 | self.center = tempF; 59 | } 60 | -(CGFloat)centerY 61 | { 62 | return self.center.y; 63 | } 64 | 65 | -(CGFloat)width 66 | { 67 | return self.frame.size.width; 68 | } 69 | 70 | -(void)setHeight:(CGFloat)height 71 | { 72 | CGRect tempF = self.frame; 73 | tempF.size.height = height; 74 | self.frame = tempF; 75 | } 76 | 77 | -(CGFloat)height 78 | { 79 | return self.frame.size.height; 80 | } 81 | 82 | -(void)setSize:(CGSize)size 83 | { 84 | CGRect tempF = self.frame; 85 | tempF.size = size; 86 | self.frame = tempF; 87 | } 88 | -(CGSize)size 89 | { 90 | return self.frame.size; 91 | } 92 | 93 | @end 94 | -------------------------------------------------------------------------------- /ZYWChart/Controller/CandleCrossScreenVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // CandleCrossScreenVC.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/5/9. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class CandleCrossScreenVC; 12 | 13 | @protocol CandleCrossScreenVCDeleate 14 | 15 | - (void)willChangeScreenMode:(CandleCrossScreenVC*)vc; 16 | 17 | @end 18 | 19 | @interface CandleCrossScreenVC : UIViewController 20 | 21 | @property (assign, nonatomic)UIInterfaceOrientation orientation; 22 | @property (nonatomic,weak) id delegate; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /ZYWChart/Controller/CandleLineVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // CandleLineVC.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2016/12/28. 6 | // Copyright © 2016年 zyw113. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CandleLineVC : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ZYWChart/Controller/LineVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // LineVC.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2016/12/27. 6 | // Copyright © 2016年 zyw113. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LineVC : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ZYWChart/Controller/LineVC.m: -------------------------------------------------------------------------------- 1 | // 2 | // LineVC.m 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2016/12/27. 6 | // Copyright © 2016年 zyw113. All rights reserved. 7 | // 8 | 9 | #import "LineVC.h" 10 | #import "ZYWLineView.h" 11 | 12 | @interface LineVC () 13 | 14 | @property (nonatomic,strong) ZYWLineView *lineView; 15 | @property (nonatomic,strong) NSArray *dataArray; 16 | 17 | @end 18 | 19 | @implementation LineVC 20 | 21 | - (void)viewDidAppear:(BOOL)animated 22 | { 23 | [super viewDidAppear:animated]; 24 | 25 | } 26 | 27 | - (void)viewDidLoad { 28 | [super viewDidLoad]; 29 | self.view.backgroundColor = [UIColor whiteColor]; 30 | self.navigationItem.title = @"折线图"; 31 | 32 | _lineView = [[ZYWLineView alloc] init]; 33 | _lineView.lineWidth = 2; 34 | _lineView.backgroundColor = [UIColor colorWithHexString:@"8B6969"]; 35 | _lineView.lineColor = [UIColor colorWithHexString:@"C0FF3E"]; 36 | _lineView.fillColor = [UIColor colorWithHexString:@"CD3278"]; 37 | _lineView.isFillColor = YES; 38 | 39 | [self.view addSubview:_lineView]; 40 | [_lineView mas_makeConstraints:^(MASConstraintMaker *make) { 41 | make.center.equalTo(self.view); 42 | make.left.right.equalTo(self.view); 43 | make.height.equalTo(@(200)); 44 | }]; 45 | [_lineView layoutIfNeeded]; 46 | _dataArray = @[@"12",@"33",@"26",@"10",@"7",@"30",@"21"]; 47 | 48 | _lineView.dataArray = _dataArray; 49 | _lineView.leftMargin = 0; 50 | _lineView.rightMargin = 0; 51 | _lineView.topMargin = 0; 52 | _lineView.bottomMargin = 0; 53 | [_lineView stockFill]; 54 | } 55 | 56 | - (void)didReceiveMemoryWarning { 57 | [super didReceiveMemoryWarning]; 58 | // Dispose of any resources that can be recreated. 59 | } 60 | 61 | /* 62 | #pragma mark - Navigation 63 | 64 | // In a storyboard-based application, you will often want to do a little preparation before navigation 65 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 66 | // Get the new view controller using [segue destinationViewController]. 67 | // Pass the selected object to the new view controller. 68 | } 69 | */ 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /ZYWChart/Controller/SlipLineVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // SlipLineVC.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2016/12/27. 6 | // Copyright © 2016年 zyw113. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SlipLineVC : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ZYWChart/Controller/SlipLineVC.m: -------------------------------------------------------------------------------- 1 | // 2 | // SlipLineVC.m 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2016/12/27. 6 | // Copyright © 2016年 zyw113. All rights reserved. 7 | // 8 | 9 | #import "SlipLineVC.h" 10 | #import "ZYWSlipLineView.h" 11 | 12 | @interface SlipLineVC () 13 | 14 | @property (nonatomic,strong) ZYWSlipLineView *slipLine; 15 | @property (nonatomic,strong) UIScrollView *scrollView; 16 | @property (nonatomic,strong) NSArray *dataArray; 17 | 18 | @end 19 | 20 | @implementation SlipLineVC 21 | 22 | - (void)viewDidLoad { 23 | [super viewDidLoad]; 24 | self.navigationItem.title = @"滑动折线图"; 25 | self.automaticallyAdjustsScrollViewInsets = NO; 26 | // Do any additional setup after loading the view. 27 | _scrollView = [[UIScrollView alloc] init]; 28 | [self.view addSubview:_scrollView]; 29 | _scrollView.showsHorizontalScrollIndicator = NO; 30 | self.view.backgroundColor = [UIColor whiteColor]; 31 | [_scrollView mas_makeConstraints:^(MASConstraintMaker *make) { 32 | make.left.right.equalTo(self.view); 33 | make.top.equalTo(self.view.mas_top).offset(80); 34 | make.height.equalTo(@(200)); 35 | }]; 36 | 37 | _slipLine = [[ZYWSlipLineView alloc] init]; 38 | _slipLine.backgroundColor = [UIColor colorWithHexString:@"8B6969"]; 39 | [_scrollView addSubview:_slipLine]; 40 | _slipLine.lineWidth = 4; 41 | _slipLine.lineColor = [UIColor colorWithHexString:@"00FF7F"]; 42 | [_slipLine mas_makeConstraints:^(MASConstraintMaker *make){ 43 | make.height.equalTo(@(200)); 44 | make.top.equalTo(_scrollView); 45 | }]; 46 | 47 | [_slipLine layoutIfNeeded]; 48 | _dataArray = @[@"12",@"33",@"44",@"55",@"7",@"10",@"28",@"12",@"33",@"11",@"63",@"7",@"10",@"66",@"12",@"41",@"28",@"12",@"55",@"77",@"21",@"12",@"33",@"54",@"30",@"7",@"20",@"21",@"12",@"33",@"44",@"55",@"7",@"10",@"28",@"12",@"33",@"11",@"63",@"7",@"10",@"66",@"12",@"41",@"28",@"12",@"55",@"77",@"21",@"12",@"33"]; 49 | _slipLine.dataArray = _dataArray; 50 | _slipLine.leftMargin = 10; 51 | _slipLine.rightMargin = 10; 52 | _slipLine.topMargin = 10; 53 | _slipLine.bottomMargin = 10; 54 | [_slipLine stockFill]; 55 | } 56 | 57 | - (void)didReceiveMemoryWarning { 58 | [super didReceiveMemoryWarning]; 59 | // Dispose of any resources that can be recreated. 60 | } 61 | 62 | /* 63 | #pragma mark - Navigation 64 | 65 | // In a storyboard-based application, you will often want to do a little preparation before navigation 66 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 67 | // Get the new view controller using [segue destinationViewController]. 68 | // Pass the selected object to the new view controller. 69 | } 70 | */ 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /ZYWChart/Controller/TimeLineVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // TimeLineVC.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/5/5. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TimeLineVC : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ZYWChart/Controller/TimeLineVC.m: -------------------------------------------------------------------------------- 1 | // 2 | // TimeLineVC.m 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/5/5. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import "TimeLineVC.h" 10 | #import "ZYWTimeLineView.h" 11 | 12 | @interface TimeLineVC () 13 | 14 | @property (nonatomic,strong) ZYWTimeLineView *timeLineView; 15 | 16 | @end 17 | 18 | @implementation TimeLineVC 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | // Do any additional setup after loading the view. 23 | 24 | self.navigationItem.title = @"分时图"; 25 | self.view.backgroundColor = [UIColor whiteColor]; 26 | _timeLineView = [ZYWTimeLineView new]; 27 | _timeLineView.backgroundColor = [UIColor whiteColor]; 28 | [self.view addSubview:_timeLineView]; 29 | [_timeLineView mas_makeConstraints:^(MASConstraintMaker *make) { 30 | make.left.right.equalTo(self.view); 31 | make.height.equalTo(@(200)); 32 | make.top.equalTo(@(100)); 33 | }]; 34 | 35 | [_timeLineView layoutIfNeeded]; 36 | 37 | NSString * path =[[NSBundle mainBundle]pathForResource:@"data.plist" ofType:nil]; 38 | NSArray * sourceArray = [[NSDictionary dictionaryWithContentsOfFile:path] objectForKey:@"data3"]; 39 | NSMutableArray * timeArray = [NSMutableArray array]; 40 | for (NSDictionary * dic in sourceArray) { 41 | ZYWTimeLineModel * e = [[ZYWTimeLineModel alloc]init]; 42 | e.currtTime = dic[@"curr_time"]; 43 | e.preClosePx = [dic[@"pre_close_px"] doubleValue]; 44 | e.avgPirce = [dic[@"avg_pirce"] doubleValue]; 45 | e.lastPirce = [dic[@"last_px"]doubleValue]; 46 | e.volume = [dic[@"last_volume_trade"]doubleValue]; 47 | e.rate = dic[@"rise_and_fall_rate"]; 48 | [timeArray addObject:e]; 49 | } 50 | _timeLineView.leftMargin =10; 51 | _timeLineView.rightMargin = 10; 52 | _timeLineView.lineColor = [UIColor blackColor]; 53 | _timeLineView.fillColor = [UIColor colorWithHexString:@"2828ff"]; 54 | _timeLineView.timesCount = 243; 55 | _timeLineView.dataArray = timeArray.mutableCopy; 56 | [_timeLineView stockFill]; 57 | } 58 | 59 | - (void)didReceiveMemoryWarning { 60 | [super didReceiveMemoryWarning]; 61 | // Dispose of any resources that can be recreated. 62 | } 63 | 64 | /* 65 | #pragma mark - Navigation 66 | 67 | // In a storyboard-based application, you will often want to do a little preparation before navigation 68 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 69 | // Get the new view controller using [segue destinationViewController]. 70 | // Pass the selected object to the new view controller. 71 | } 72 | */ 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /ZYWChart/Help/ZYWCalcuteTool.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWCalcuteTool.h 3 | // ZYWChart 4 | // 5 | // Created by limc on 12/26/13. 6 | // Copyright (c) 2013 limc. All rights reserved. 7 | // 8 | 9 | #import "ta_libc.h" 10 | #import "ZYWLineData.h" 11 | #import "ZYWLineUntil.h" 12 | 13 | ZYWLineData * computeMAData(NSArray *items,int period); 14 | NSMutableArray* computeMACDData(NSArray *items); 15 | NSMutableArray *computeKDJData(NSArray *items); 16 | NSMutableArray *computeWRData(NSArray *items,int period); 17 | -------------------------------------------------------------------------------- /ZYWChart/Help/ZYWCalcuteUntil.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWCalcuteUntil.h 3 | // ZYWChart 4 | // 5 | // Created by limc on 12/26/13. 6 | // Copyright (c) 2013 limc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef NS_ENUM(NSUInteger, MACDParameter) { 12 | MACDParameterDIFF, 13 | MACDParameterMACD, 14 | MACDParameterDEA, 15 | }; 16 | 17 | void NSArrayToCArray(NSArray *array, double outCArray[]); 18 | 19 | NSArray *CArrayToNSArray(const double inCArray[], int length, int outBegIdx, int outNBElement); 20 | 21 | NSArray *CArrayToNSArrayWithParameter(const double inCArray[], int length, int outBegIdx, int outNBElement, double parmeter); 22 | 23 | // KDJ 24 | NSArray *KDJCArrayToNSArray(const double inCArray[], int length, int outBegIdx, int outNBElement); 25 | 26 | // MACD类型 27 | NSArray *MACDCArrayToNSArray(const double inCArray[], int length, int outBegIdx, int outNBElement, NSArray *items, MACDParameter parameter); 28 | 29 | NSArray *MDCArrayToNSArray(const double inCArray[], int length, int outBegIdx, int outNBElement, NSArray *items); 30 | 31 | void freeAndSetNULL(void *ptr); 32 | 33 | CGFloat customComputeMA(NSArray *items, NSInteger days); 34 | -------------------------------------------------------------------------------- /ZYWChart/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UIViewControllerBasedStatusBarAppearance 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /ZYWChart/Model/ZYWCandleModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWCandleModel.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2016/12/28. 6 | // Copyright © 2016年 zyw113. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ZYWCandleModel : NSObject 12 | 13 | @property (assign, nonatomic) CGFloat high; 14 | @property (assign, nonatomic) CGFloat low; 15 | @property (assign, nonatomic) CGFloat open; 16 | @property (assign, nonatomic) CGFloat close; 17 | @property (copy, nonatomic) NSString *date; 18 | @property (assign, nonatomic) BOOL isDrawDate; 19 | @property (assign, nonatomic) NSInteger localIndex; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /ZYWChart/Model/ZYWCandleModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWCandleModel.m 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2016/12/28. 6 | // Copyright © 2016年 zyw113. All rights reserved. 7 | // 8 | 9 | #import "ZYWCandleModel.h" 10 | 11 | @implementation ZYWCandleModel 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ZYWChart/Model/ZYWCandlePostionModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWCandlePostionModel.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/1/15. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ZYWCandlePostionModel : NSObject 12 | 13 | /** 14 | * 开盘点 15 | */ 16 | @property (nonatomic, assign) CGPoint openPoint; 17 | 18 | /** 19 | * 收盘点 20 | */ 21 | @property (nonatomic, assign) CGPoint closePoint; 22 | 23 | /** 24 | * 最高点 25 | */ 26 | @property (nonatomic, assign) CGPoint highPoint; 27 | 28 | /** 29 | * 最低点 30 | */ 31 | @property (nonatomic, assign) CGPoint lowPoint; 32 | 33 | /** 34 | * 日期 35 | */ 36 | @property (nonatomic, copy) NSString *date; 37 | 38 | @property (nonatomic,assign) BOOL isDrawDate; 39 | 40 | @property (assign, nonatomic) NSInteger localIndex; 41 | 42 | + (instancetype) modelWithOpen:(CGPoint)openPoint close:(CGPoint)closePoint high:(CGPoint)highPoint low:(CGPoint)lowPoint date:(NSString*)date; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /ZYWChart/Model/ZYWCandlePostionModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWCandlePostionModel.m 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/1/15. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import "ZYWCandlePostionModel.h" 10 | 11 | @implementation ZYWCandlePostionModel 12 | 13 | + (instancetype) modelWithOpen:(CGPoint)openPoint close:(CGPoint)closePoint high:(CGPoint)highPoint low:(CGPoint)lowPoint date:(NSString*)date 14 | { 15 | ZYWCandlePostionModel *candleModel = [ZYWCandlePostionModel new]; 16 | candleModel.openPoint = openPoint; 17 | candleModel.closePoint = closePoint; 18 | candleModel.highPoint = highPoint; 19 | candleModel.lowPoint = lowPoint; 20 | candleModel.date = date; 21 | return candleModel; 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /ZYWChart/Model/ZYWLineData.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWLineData.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/2/8. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ZYWLineData : NSObject 12 | 13 | @property (nonatomic,copy) NSArray *data; 14 | @property (nonatomic,copy) NSString *title; 15 | @property (nonatomic,strong) UIColor *color; 16 | 17 | - (id)initWithData:(NSMutableArray *)data color:(UIColor *)color title:(NSString *)title; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /ZYWChart/Model/ZYWLineData.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWLineData.m 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/2/8. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import "ZYWLineData.h" 10 | 11 | @implementation ZYWLineData 12 | 13 | - (id)initWithData:(NSMutableArray *)data color:(UIColor *)color title:(NSString *)title 14 | { 15 | self = [self init]; 16 | if (self) 17 | { 18 | self.data = data; 19 | self.color = color; 20 | self.title = title; 21 | } 22 | 23 | return self; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /ZYWChart/Model/ZYWLineModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWLineModel.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2016/12/27. 6 | // Copyright © 2016年 zyw113. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ZYWLineModel : NSObject 12 | 13 | @property (nonatomic,assign) CGFloat xPosition; 14 | @property (nonatomic,assign) CGFloat yPosition; 15 | @property (nonatomic,strong) UIColor *lineColor; 16 | 17 | + (instancetype)initPositon:(CGFloat)xPositon yPosition:(CGFloat)yPosition color:(UIColor*)color; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /ZYWChart/Model/ZYWLineModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWLineModel.m 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2016/12/27. 6 | // Copyright © 2016年 zyw113. All rights reserved. 7 | // 8 | 9 | #import "ZYWLineModel.h" 10 | @implementation ZYWLineModel 11 | 12 | +(instancetype)initPositon:(CGFloat)xPositon yPosition:(CGFloat)yPosition color:(UIColor*)color 13 | { 14 | ZYWLineModel *model = [[ZYWLineModel alloc] init]; 15 | model.xPosition = xPositon; 16 | model.yPosition = yPosition; 17 | model.lineColor = color; 18 | return model; 19 | } 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /ZYWChart/Model/ZYWLineUntil.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWLineUntil.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/3/13. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ZYWLineUntil : NSObject 12 | 13 | @property(assign, nonatomic) CGFloat value; 14 | @property(retain, nonatomic) NSString *date; 15 | 16 | - (id)initWithValue:(CGFloat)value date:(NSString *)date; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /ZYWChart/Model/ZYWLineUntil.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWLineUntil.m 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/3/13. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import "ZYWLineUntil.h" 10 | 11 | @implementation ZYWLineUntil 12 | 13 | - (id)initWithValue:(CGFloat)value date:(NSString *)date { 14 | self = [self init]; 15 | 16 | if (self) { 17 | self.value = value; 18 | self.date = date; 19 | } 20 | return self; 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /ZYWChart/Model/ZYWMacdModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWMacdModel.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/3/13. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ZYWMacdModel : NSObject 12 | 13 | @property(assign, nonatomic) CGFloat dea; 14 | @property(assign, nonatomic) CGFloat diff; 15 | @property(assign, nonatomic) CGFloat macd; 16 | @property(copy, nonatomic) NSString *date; 17 | 18 | - (id)initWithDea:(CGFloat)dea diff:(CGFloat)diff macd:(CGFloat)macd date:(NSString *)date; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ZYWChart/Model/ZYWMacdModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWMacdModel.m 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/3/13. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import "ZYWMacdModel.h" 10 | 11 | @implementation ZYWMacdModel 12 | 13 | - (id)initWithDea:(CGFloat)dea diff:(CGFloat)diff macd:(CGFloat)macd date:(NSString *)date 14 | { 15 | ZYWMacdModel *model = [[ZYWMacdModel alloc] init]; 16 | model.dea = dea; 17 | model.diff = diff; 18 | model.macd = macd; 19 | model.date = date; 20 | return model; 21 | } 22 | @end 23 | -------------------------------------------------------------------------------- /ZYWChart/Model/ZYWMacdPostionModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWMacdPostionModel.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/3/13. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ZYWMacdPostionModel : NSObject 12 | 13 | @property (nonatomic,assign) CGPoint startPoint; 14 | @property (nonatomic,assign) CGPoint endPoint; 15 | 16 | + (instancetype)initPostion:(CGPoint)startPoint endPoint:(CGPoint)endPoint; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /ZYWChart/Model/ZYWMacdPostionModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWMacdPostionModel.m 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/3/13. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import "ZYWMacdPostionModel.h" 10 | 11 | @implementation ZYWMacdPostionModel 12 | 13 | +(instancetype)initPostion:(CGPoint)startPoint endPoint:(CGPoint)endPoint 14 | { 15 | ZYWMacdPostionModel *model = [[ZYWMacdPostionModel alloc] init]; 16 | model.startPoint = startPoint; 17 | model.endPoint = endPoint; 18 | return model; 19 | } 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /ZYWChart/Model/ZYWTimeLineModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWTimeLineModel.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/5/13. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ZYWTimeLineModel : NSObject 12 | 13 | @property (nonatomic, copy) NSString *currtTime; 14 | @property (nonatomic, assign) CGFloat preClosePx; 15 | @property (nonatomic, assign) CGFloat avgPirce; 16 | @property (nonatomic, assign) CGFloat lastPirce; 17 | @property (nonatomic, assign) CGFloat totalVolume; 18 | @property (nonatomic, assign) CGFloat volume; 19 | @property (nonatomic, assign) CGFloat trade; 20 | @property (nonatomic, copy) NSString *rate; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /ZYWChart/Model/ZYWTimeLineModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWTimeLineModel.m 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/5/13. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import "ZYWTimeLineModel.h" 10 | 11 | @implementation ZYWTimeLineModel 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ZYWChart/PriceView/ZYWCrossPriceView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWCrossPriceView.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/5/9. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ZYWCrossPriceView : UIView 12 | 13 | @property (nonatomic,strong) ZYWCandleModel *model; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /ZYWChart/PriceView/ZYWCrossPriceView.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWCrossPriceView.m 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/5/9. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import "ZYWCrossPriceView.h" 10 | 11 | @interface ZYWCrossPriceView() 12 | 13 | @property (nonatomic,strong) UILabel *highLabel; 14 | @property (nonatomic,strong) UILabel *lowLabel; 15 | @property (nonatomic,strong) UILabel *openLabel; 16 | @property (nonatomic,strong) UILabel *closeLabel; 17 | 18 | @end 19 | @implementation ZYWCrossPriceView 20 | 21 | -(instancetype)initWithFrame:(CGRect)frame 22 | { 23 | self = [super initWithFrame:frame]; 24 | if (self) 25 | { 26 | [self addSubviews]; 27 | [self addConstraints]; 28 | } 29 | return self; 30 | } 31 | 32 | -(void)addSubviews 33 | { 34 | _highLabel = [self createLabel]; 35 | [self addSubview:_highLabel]; 36 | 37 | _lowLabel = [self createLabel]; 38 | [self addSubview:_lowLabel]; 39 | 40 | _openLabel = [self createLabel]; 41 | [self addSubview:_openLabel]; 42 | 43 | _closeLabel = [self createLabel]; 44 | [self addSubview:_closeLabel]; 45 | } 46 | 47 | -(void)addConstraints 48 | { 49 | CGFloat width = DEVICE_HEIGHT/4; 50 | [_highLabel mas_makeConstraints:^(MASConstraintMaker *make) { 51 | make.left.equalTo(self.mas_left); 52 | make.centerY.equalTo(self); 53 | make.width.equalTo(@(width)); 54 | 55 | }]; 56 | 57 | [_lowLabel mas_makeConstraints:^(MASConstraintMaker *make) { 58 | make.left.equalTo(self.highLabel.mas_right); 59 | make.width.equalTo(self.highLabel); 60 | make.centerY.equalTo(self); 61 | }]; 62 | 63 | [_openLabel mas_makeConstraints:^(MASConstraintMaker *make) { 64 | make.left.equalTo(self.lowLabel.mas_right); 65 | make.width.equalTo(self.highLabel); 66 | make.centerY.equalTo(self); 67 | }]; 68 | 69 | [_closeLabel mas_makeConstraints:^(MASConstraintMaker *make) { 70 | make.left.equalTo(self.openLabel.mas_right); 71 | make.width.equalTo(self.highLabel); 72 | make.centerY.equalTo(self); 73 | }]; 74 | } 75 | 76 | -(void)setModel:(ZYWCandleModel *)model 77 | { 78 | _model = model; 79 | _highLabel.text = [NSString stringWithFormat:@"%@%.2f",@"最高价 : ",_model.high]; 80 | _lowLabel.text = [NSString stringWithFormat:@"%@%.2f",@"最低价 : ",_model.low]; 81 | _openLabel.text = [NSString stringWithFormat:@"%@%.2f",@"开盘价 : ",_model.open]; 82 | _closeLabel.text = [NSString stringWithFormat:@"%@%.2f",@"收盘价 : ",_model.close]; 83 | } 84 | 85 | -(UILabel*)createLabel 86 | { 87 | UILabel *label = [UILabel new]; 88 | label.textColor = [UIColor whiteColor]; 89 | label.font = [UIFont systemFontOfSize:14]; 90 | label.textAlignment = NSTextAlignmentCenter; 91 | return label; 92 | } 93 | 94 | 95 | @end 96 | -------------------------------------------------------------------------------- /ZYWChart/PriceView/ZYWPriceView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWPriceView.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/04/30. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ZYWPriceView : UIView 12 | 13 | @property (nonatomic,strong) UILabel *maxPriceLabel; 14 | @property (nonatomic,strong) UILabel *minPriceLabel; 15 | @property (nonatomic,strong) UILabel *middlePriceLabel; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /ZYWChart/PriceView/ZYWPriceView.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWPriceView.m 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/04/30. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import "ZYWPriceView.h" 10 | 11 | @implementation ZYWPriceView 12 | 13 | -(UILabel *)maxPriceLabel 14 | { 15 | if (!_maxPriceLabel) 16 | { 17 | _maxPriceLabel = [self createLabel]; 18 | [self addSubview:_maxPriceLabel]; 19 | [_maxPriceLabel mas_makeConstraints:^(MASConstraintMaker *make) { 20 | make.top.left.equalTo(self); 21 | }]; 22 | } 23 | return _maxPriceLabel; 24 | } 25 | 26 | -(UILabel *)middlePriceLabel 27 | { 28 | if (!_middlePriceLabel) 29 | { 30 | _middlePriceLabel = [self createLabel]; 31 | [self addSubview:_middlePriceLabel]; 32 | [_middlePriceLabel mas_makeConstraints:^(MASConstraintMaker *make) { 33 | make.centerY.left.equalTo(self); 34 | }]; 35 | } 36 | return _middlePriceLabel; 37 | } 38 | 39 | -(UILabel *)minPriceLabel 40 | { 41 | if (!_minPriceLabel) 42 | { 43 | _minPriceLabel = [self createLabel]; 44 | [self addSubview:_minPriceLabel]; 45 | [_minPriceLabel mas_makeConstraints:^(MASConstraintMaker *make) { 46 | make.bottom.left.equalTo(self); 47 | }]; 48 | } 49 | return _minPriceLabel; 50 | } 51 | 52 | -(UILabel*)createLabel 53 | { 54 | UILabel *label = [UILabel new]; 55 | label.textColor = [UIColor blackColor]; 56 | label.font = [UIFont systemFontOfSize:11]; 57 | return label; 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /ZYWChart/PriceView/ZYWQuotaView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWQuotaView.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/04/30. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ZYWCandleModel.h" 11 | 12 | @interface ZYWQuotaView : UIView 13 | 14 | @property (nonatomic,strong) ZYWCandleModel *model; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /ZYWChart/PriceView/ZYWQuotaView.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWQuotaView.m 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/04/30. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import "ZYWQuotaView.h" 10 | 11 | @interface ZYWQuotaView() 12 | 13 | @property (nonatomic,strong) UILabel *highLabel; 14 | @property (nonatomic,strong) UILabel *lowLabel; 15 | @property (nonatomic,strong) UILabel *openLabel; 16 | @property (nonatomic,strong) UILabel *closeLabel; 17 | 18 | @end 19 | @implementation ZYWQuotaView 20 | 21 | -(instancetype)initWithFrame:(CGRect)frame 22 | { 23 | self = [super initWithFrame:frame]; 24 | if (self) 25 | { 26 | [self addSubviews]; 27 | [self addConstraints]; 28 | } 29 | return self; 30 | } 31 | 32 | -(void)addSubviews 33 | { 34 | _highLabel = [self createLabel]; 35 | [self addSubview:_highLabel]; 36 | 37 | _lowLabel = [self createLabel]; 38 | [self addSubview:_lowLabel]; 39 | 40 | _openLabel = [self createLabel]; 41 | [self addSubview:_openLabel]; 42 | 43 | _closeLabel = [self createLabel]; 44 | [self addSubview:_closeLabel]; 45 | } 46 | 47 | -(void)addConstraints 48 | { 49 | [_highLabel mas_makeConstraints:^(MASConstraintMaker *make) { 50 | make.centerX.equalTo(self.mas_centerX).multipliedBy(0.5); 51 | make.top.equalTo(@(40)); 52 | }]; 53 | 54 | [_lowLabel mas_makeConstraints:^(MASConstraintMaker *make) { 55 | make.centerX.equalTo(self.mas_centerX).multipliedBy(1.5); 56 | make.top.equalTo(_highLabel); 57 | }]; 58 | 59 | [_openLabel mas_makeConstraints:^(MASConstraintMaker *make) { 60 | make.centerX.equalTo(_highLabel); 61 | make.top.equalTo(_highLabel.mas_bottom).offset(10); 62 | }]; 63 | 64 | [_closeLabel mas_makeConstraints:^(MASConstraintMaker *make) { 65 | make.centerX.equalTo(_lowLabel); 66 | make.top.equalTo(_lowLabel.mas_bottom).offset(10); 67 | }]; 68 | } 69 | 70 | -(void)setModel:(ZYWCandleModel *)model 71 | { 72 | _model = model; 73 | _highLabel.text = [NSString stringWithFormat:@"%@%.2f",@"最高价 : ",_model.high]; 74 | _lowLabel.text = [NSString stringWithFormat:@"%@%.2f",@"最低价 : ",_model.low]; 75 | _openLabel.text = [NSString stringWithFormat:@"%@%.2f",@"开盘价 : ",_model.open]; 76 | _closeLabel.text = [NSString stringWithFormat:@"%@%.2f",@"收盘价 : ",_model.close]; 77 | } 78 | 79 | -(UILabel*)createLabel 80 | { 81 | UILabel *label = [UILabel new]; 82 | label.textColor = [UIColor whiteColor]; 83 | label.font = [UIFont systemFontOfSize:14]; 84 | return label; 85 | } 86 | 87 | @end 88 | -------------------------------------------------------------------------------- /ZYWChart/View/ZYWBaseChartView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWBaseChartView.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2016/12/17. 6 | // Copyright © 2016年 zyw113. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ZYWBaseChartView : UIView 12 | { 13 | CGFloat _maxY; 14 | CGFloat _minY; 15 | CGFloat _maxX; 16 | CGFloat _minX; 17 | CGFloat _scaleY; 18 | CGFloat _scaleX; 19 | CGFloat _lineWidth; 20 | CGFloat _lineSpace; 21 | CGFloat _leftMargin; 22 | CGFloat _rightMargin; 23 | CGFloat _topMargin; 24 | CGFloat _bottomMargin; 25 | UIColor *_lineColor; 26 | } 27 | 28 | @property (nonatomic,assign) CGFloat maxY; 29 | @property (nonatomic,assign) CGFloat minY; 30 | @property (nonatomic,assign) CGFloat maxX; 31 | @property (nonatomic,assign) CGFloat minX; 32 | @property (nonatomic,assign) CGFloat scaleY; 33 | @property (nonatomic,assign) CGFloat scaleX; 34 | @property (nonatomic,assign) CGFloat lineWidth; 35 | @property (nonatomic,assign) CGFloat lineSpace; 36 | @property (nonatomic,assign) CGFloat leftMargin; 37 | @property (nonatomic,assign) CGFloat rightMargin; 38 | @property (nonatomic,assign) CGFloat topMargin; 39 | @property (nonatomic,assign) CGFloat bottomMargin; 40 | @property (nonatomic,strong) UIColor *lineColor; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /ZYWChart/View/ZYWBaseChartView.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWBaseChartView.m 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2016/12/17. 6 | // Copyright © 2016年 zyw113. All rights reserved. 7 | // 8 | 9 | #import "ZYWBaseChartView.h" 10 | 11 | @implementation ZYWBaseChartView 12 | 13 | @synthesize maxY = _maxY; 14 | @synthesize minY = _minY; 15 | @synthesize maxX = _maxX; 16 | @synthesize minX = _minX; 17 | @synthesize scaleY = _scaleY; 18 | @synthesize scaleX = _scaleX; 19 | @synthesize lineWidth = _lineWidth; 20 | @synthesize lineSpace = _lineSpace; 21 | @synthesize leftMargin = _leftMargin; 22 | @synthesize rightMargin = _rightMargin; 23 | @synthesize topMargin = _topMargin; 24 | @synthesize bottomMargin = _bottomMargin; 25 | @synthesize lineColor = _lineColor; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /ZYWChart/View/ZYWCandleChartView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWCandleChartView.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2016/12/17. 6 | // Copyright © 2016年 zyw113. All rights reserved. 7 | // 8 | 9 | #import "ZYWBaseChartView.h" 10 | #import "ZYWCandleModel.h" 11 | #import "ZYWCandleProtocol.h" 12 | 13 | @interface ZYWCandleChartView : ZYWBaseChartView 14 | 15 | /** 16 | 数据源数组 在调用绘制方法之前设置 17 | */ 18 | @property (nonatomic,strong) NSMutableArray<__kindof ZYWCandleModel*> *dataArray; 19 | 20 | /** 21 | 当前屏幕范围内显示的k线模型数组 22 | */ 23 | @property (nonatomic,strong) NSMutableArray *currentDisplayArray; 24 | 25 | /** 26 | 当前屏幕范围内显示的k线位置数组 27 | */ 28 | @property (nonatomic,strong) NSMutableArray *currentPostionArray; 29 | 30 | /** 31 | 可视区域显示多少根k线 32 | */ 33 | @property (nonatomic,assign) NSInteger displayCount; 34 | 35 | /** 36 | k线之间的距离 37 | */ 38 | @property (nonatomic,assign) CGFloat candleSpace; 39 | 40 | /** 41 | k线的宽度 根据每页k线的根数和k线之间的距离动态计算得出 42 | */ 43 | @property (nonatomic,assign) CGFloat candleWidth; 44 | 45 | /** 46 | k线最小高度 47 | */ 48 | @property (nonatomic,assign) CGFloat minHeight; 49 | 50 | /** 51 | 当前屏幕范围内绘制起点位置 52 | */ 53 | @property (nonatomic,assign) NSInteger leftPostion; 54 | 55 | /** 56 | 当前绘制的起始下标 57 | */ 58 | @property (nonatomic,assign) NSInteger currentStartIndex; 59 | 60 | /** 61 | 滑到最右侧的偏移量 62 | */ 63 | @property (nonatomic,assign) CGFloat previousOffsetX; 64 | 65 | /** 66 | 当前偏移量 67 | */ 68 | @property (nonatomic,assign) CGFloat contentOffset; 69 | 70 | @property (nonatomic,assign) BOOL kvoEnable; 71 | 72 | /** 73 | 长按手势返回对应model的相对位置 74 | 75 | @param xPostion 手指在屏幕的位置 76 | @return 距离手指位置最近的model位置 77 | */ 78 | - (CGPoint)getLongPressModelPostionWithXPostion:(CGFloat)xPostion; 79 | 80 | /** 81 | 填充 82 | */ 83 | - (void)stockFill; 84 | 85 | /** 86 | 刷新右拉加载调用 87 | */ 88 | - (void)reload; 89 | 90 | /** 91 | 宽度计算 92 | */ 93 | - (void)calcuteCandleWidth; 94 | 95 | /** 96 | 更新宽度 97 | */ 98 | - (void)updateWidth; 99 | 100 | /** 101 | 绘制主方法 102 | */ 103 | - (void)drawKLine; 104 | 105 | - (void)updateWidthWithNoOffset; 106 | 107 | @property (nonatomic,weak) id delegate; 108 | 109 | @end 110 | -------------------------------------------------------------------------------- /ZYWChart/View/ZYWCandleProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWCandleProtocol.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/5/4. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol ZYWCandleProtocol 12 | 13 | @optional 14 | 15 | /** 16 | 取得当前屏幕内模型数组的开始下标以及个数 17 | 18 | @param leftPostion 当前屏幕最右边的位置 19 | @param index 下标 20 | @param count 个数 21 | */ 22 | - (void)displayScreenleftPostion:(CGFloat)leftPostion startIndex:(NSInteger)index count:(NSInteger)count; 23 | 24 | /** 25 | 长按手势获得当前k线下标以及模型 26 | 27 | @param kLineModeIndex 当前k线在可视范围数组的位置下标 28 | @param kLineModel k线模型 29 | */ 30 | - (void)longPressCandleViewWithIndex:(NSInteger)kLineModeIndex kLineModel:(ZYWCandleModel *)kLineModel; 31 | 32 | /** 33 | 返回当前屏幕最后一根k线模型 34 | 35 | @param kLineModel k线模型 36 | */ 37 | - (void)displayLastModel:(ZYWCandleModel *)kLineModel; 38 | 39 | /** 40 | 加载更多数据 41 | */ 42 | - (void)displayMoreData; 43 | 44 | @end 45 | 46 | -------------------------------------------------------------------------------- /ZYWChart/View/ZYWKdjLineView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWKdjLineView.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/4/20. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import "ZYWBaseChartView.h" 10 | 11 | @interface ZYWKdjLineView : ZYWBaseChartView 12 | 13 | @property (nonatomic,strong) NSMutableArray *dataArray; 14 | @property (nonatomic, assign) CGFloat leftPostion; 15 | @property (nonatomic, assign) CGFloat candleWidth; 16 | @property (nonatomic, assign) CGFloat candleSpace; 17 | @property (nonatomic, assign) NSInteger startIndex; 18 | @property (nonatomic, assign) NSInteger displayCount; 19 | 20 | - (void)stockFill; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /ZYWChart/View/ZYWLineView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWLineView.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2016/12/27. 6 | // Copyright © 2016年 zyw113. All rights reserved. 7 | // 8 | 9 | #import "ZYWBaseChartView.h" 10 | 11 | @interface ZYWLineView : ZYWBaseChartView 12 | 13 | @property (nonatomic,strong) NSArray *dataArray; 14 | @property (nonatomic,strong) UIColor *fillColor; 15 | @property (nonatomic,assign) BOOL isFillColor; 16 | 17 | - (void)stockFill; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /ZYWChart/View/ZYWLineView.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWLineView.m 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2016/12/27. 6 | // Copyright © 2016年 zyw113. All rights reserved. 7 | // 8 | 9 | #import "ZYWLineView.h" 10 | 11 | @interface ZYWLineView () 12 | 13 | @property (nonatomic,strong) NSMutableArray *modelPostionArray; 14 | @property (nonatomic, strong) CAShapeLayer *lineChartLayer; 15 | 16 | @end 17 | 18 | @implementation ZYWLineView 19 | 20 | #pragma mark setter 21 | 22 | - (NSMutableArray*)modelPostionArray 23 | { 24 | if (!_modelPostionArray) 25 | { 26 | _modelPostionArray = [NSMutableArray array]; 27 | } 28 | return _modelPostionArray; 29 | } 30 | 31 | #pragma mark draw 32 | 33 | - (void)drawRect:(CGRect)rect 34 | { 35 | [super drawRect:rect]; 36 | [self draw]; 37 | } 38 | 39 | - (void)drawLineLayer 40 | { 41 | UIBezierPath *path = [UIBezierPath drawLine:self.modelPostionArray]; 42 | self.lineChartLayer = [CAShapeLayer layer]; 43 | self.lineChartLayer.path = path.CGPath; 44 | self.lineChartLayer.strokeColor = self.lineColor.CGColor; 45 | self.lineChartLayer.fillColor = [[UIColor clearColor] CGColor]; 46 | 47 | self.lineChartLayer.lineWidth = self.lineWidth; 48 | self.lineChartLayer.lineCap = kCALineCapRound; 49 | self.lineChartLayer.lineJoin = kCALineJoinRound; 50 | self.lineChartLayer.contentsScale = [UIScreen mainScreen].scale; 51 | [self.layer addSublayer:self.lineChartLayer]; 52 | 53 | if (_isFillColor) 54 | { 55 | ZYWLineModel *lastPoint = _modelPostionArray.lastObject; 56 | [path addLineToPoint:CGPointMake(lastPoint.xPosition,self.height - self.topMargin)]; 57 | [path addLineToPoint:CGPointMake(self.leftMargin, self.height - self.topMargin)]; 58 | path.lineWidth = 0; 59 | [_fillColor setFill]; 60 | [path fill]; 61 | [path stroke]; 62 | [path closePath]; 63 | } 64 | [self startAnimation]; 65 | } 66 | 67 | - (void)startAnimation 68 | { 69 | CABasicAnimation*pathAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"]; 70 | pathAnimation.duration = 2.0f; 71 | pathAnimation.timingFunction= [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 72 | pathAnimation.fromValue=@0.0f; 73 | pathAnimation.toValue=@(1); 74 | [self.lineChartLayer addAnimation:pathAnimation forKey:nil]; 75 | } 76 | 77 | - (void)initModelPostion 78 | { 79 | __weak typeof(self) this = self; 80 | [_dataArray enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { 81 | CGFloat value = [_dataArray[idx] floatValue]; 82 | CGFloat xPostion = this.lineSpace*idx + this.leftMargin; 83 | CGFloat yPostion = (this.maxY - value)*this.scaleY + this.topMargin; 84 | ZYWLineModel *lineModel = [ZYWLineModel initPositon:xPostion yPosition:yPostion color:this.lineColor]; 85 | [this.modelPostionArray addObject:lineModel]; 86 | }]; 87 | } 88 | 89 | -(void)initConfig 90 | { 91 | self.lineSpace = (DEVICE_WIDTH - self.leftMargin - self.rightMargin)/(_dataArray.count-1) ; 92 | NSNumber *min = [_dataArray valueForKeyPath:@"@min.floatValue"]; 93 | NSNumber *max = [_dataArray valueForKeyPath:@"@max.floatValue"]; 94 | self.maxY = [max floatValue]; 95 | self.minY = [min floatValue]; 96 | self.scaleY = (self.height - self.topMargin - self.bottomMargin)/(self.maxY-self.minY); 97 | } 98 | 99 | - (void)draw 100 | { 101 | [self initConfig]; 102 | [self initModelPostion]; 103 | [self drawLineLayer]; 104 | } 105 | 106 | - (void)stockFill 107 | { 108 | [self setNeedsDisplay]; 109 | } 110 | 111 | @end 112 | -------------------------------------------------------------------------------- /ZYWChart/View/ZYWMacdView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWMacdView.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/3/13. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ZYWMacdModel.h" 11 | 12 | @interface ZYWMacdView : ZYWBaseChartView 13 | 14 | @property (nonatomic,strong) NSMutableArray <__kindof ZYWMacdModel*>*dataArray; 15 | 16 | @property (nonatomic,assign) CGFloat leftPostion; 17 | @property (nonatomic,assign) NSInteger startIndex; 18 | @property (nonatomic,assign) NSInteger displayCount; 19 | @property (nonatomic,assign) CGFloat candleWidth; 20 | @property (nonatomic,assign) CGFloat candleSpace; 21 | 22 | - (void)stockFill; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /ZYWChart/View/ZYWSlipLineView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWSlipLineView.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2016/12/27. 6 | // Copyright © 2016年 zyw113. All rights reserved. 7 | // 8 | 9 | #import "ZYWBaseChartView.h" 10 | 11 | @interface ZYWSlipLineView : ZYWBaseChartView 12 | 13 | @property (nonatomic,strong) NSArray *dataArray; 14 | 15 | - (CGPoint)getLongPressModelPostionWithXPostion:(CGFloat)xPostion; 16 | - (void)stockFill; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /ZYWChart/View/ZYWTecnnicalView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWTecnnicalView.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/2/26. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol ZYWTecnnicalViewDelegate 12 | 13 | - (void)didSelectButton:(UIButton*)button index:(NSInteger)index; 14 | 15 | @end 16 | 17 | @interface ZYWTecnnicalView : UIView 18 | 19 | @property (nonatomic,strong) UIButton *macdButton; 20 | @property (nonatomic,strong) UIButton *wrButton; 21 | @property (nonatomic,strong) UIButton *kdjButton; 22 | @property (nonatomic, weak) id delagate; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /ZYWChart/View/ZYWTecnnicalView.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWTecnnicalView.m 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/2/26. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import "ZYWTecnnicalView.h" 10 | 11 | @interface ZYWTecnnicalView () 12 | 13 | @property (nonatomic,assign) NSInteger currentButtonTag; 14 | 15 | @end 16 | 17 | @implementation ZYWTecnnicalView 18 | 19 | - (UIButton*)macdButton 20 | { 21 | if (!_macdButton) 22 | { 23 | _macdButton = [self createButtonWithTag:1]; 24 | [self addSubview:_macdButton]; 25 | _macdButton.backgroundColor = [UIColor colorWithHexString:@"EE3B3B"]; 26 | _macdButton.selected = YES; 27 | _currentButtonTag = _macdButton.tag; 28 | [_macdButton mas_makeConstraints:^(MASConstraintMaker *make) { 29 | make.height.left.top.equalTo(self); 30 | make.width.equalTo(@(60)); 31 | }]; 32 | } 33 | return _macdButton; 34 | } 35 | 36 | - (UIButton*)wrButton 37 | { 38 | if (!_wrButton) 39 | { 40 | _wrButton = [self createButtonWithTag:2]; 41 | [self addSubview:_wrButton]; 42 | [_wrButton mas_makeConstraints:^(MASConstraintMaker *make) { 43 | make.size.top.equalTo(self.macdButton); 44 | make.left.equalTo(self.macdButton.mas_right); 45 | }]; 46 | } 47 | return _wrButton; 48 | } 49 | 50 | - (UIButton*)kdjButton 51 | { 52 | if (!_kdjButton) 53 | { 54 | _kdjButton = [self createButtonWithTag:3]; 55 | [self addSubview:_kdjButton]; 56 | [_kdjButton mas_makeConstraints:^(MASConstraintMaker *make) { 57 | make.size.top.equalTo(self.wrButton); 58 | make.left.equalTo(self.wrButton.mas_right); 59 | }]; 60 | } 61 | return _kdjButton; 62 | } 63 | 64 | #pragma mark private 65 | 66 | - (UIButton*)createButtonWithTag:(NSInteger)tag 67 | { 68 | UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; 69 | button.tag = tag; 70 | [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 71 | [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 72 | [button.titleLabel setFont:[UIFont systemFontOfSize:13.f]]; 73 | button.backgroundColor = [UIColor colorWithHexString:@"EE6363"]; 74 | [button addTarget:self action:@selector(didClick:) forControlEvents:UIControlEventTouchUpInside]; 75 | return button; 76 | } 77 | 78 | - (void)didClick:(UIButton*)button 79 | { 80 | if (_currentButtonTag == button.tag) 81 | { 82 | return; 83 | } 84 | 85 | button.selected = !button.selected; 86 | UIButton *prevButton = [self viewWithTag:_currentButtonTag]; 87 | prevButton.backgroundColor = [UIColor colorWithHexString:@"EE6363"]; 88 | prevButton.selected = NO; 89 | button.backgroundColor = [UIColor colorWithHexString:@"EE3B3B"]; 90 | _currentButtonTag = button.tag; 91 | 92 | if (self.delagate && [self.delagate respondsToSelector:@selector(didSelectButton:index:)]) 93 | { 94 | [self.delagate didSelectButton:button index:button.tag]; 95 | } 96 | } 97 | 98 | @end 99 | -------------------------------------------------------------------------------- /ZYWChart/View/ZYWTimeLineView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWTimeLineView.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/5/11. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ZYWTimeLineModel.h" 11 | 12 | @interface ZYWTimeLineView : ZYWBaseChartView 13 | 14 | @property (nonatomic,assign) NSInteger timesCount; 15 | @property (nonatomic,strong) UIColor *fillColor; 16 | @property (nonatomic,strong) NSArray<__kindof ZYWTimeLineModel*> *dataArray; 17 | -(void)stockFill; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /ZYWChart/View/ZYWWrLineView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWWrLineView.h 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/5/3. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import "ZYWBaseChartView.h" 10 | 11 | @interface ZYWWrLineView : ZYWBaseChartView 12 | 13 | @property (nonatomic,strong) NSMutableArray *dataArray; 14 | @property (nonatomic, assign) CGFloat leftPostion; 15 | @property (nonatomic ,assign) CGFloat candleWidth; 16 | @property (nonatomic, assign) CGFloat candleSpace; 17 | @property (nonatomic, assign) NSInteger startIndex; 18 | @property (nonatomic, assign) NSInteger displayCount; 19 | 20 | - (void)stockFill; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /ZYWChart/View/ZYWWrLineView.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWWrLineView.m 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2017/5/3. 6 | // Copyright © 2017年 zyw113. All rights reserved. 7 | // 8 | 9 | #import "ZYWWrLineView.h" 10 | #import "ZYWLineData.h" 11 | #import "ZYWLineUntil.h" 12 | 13 | @interface ZYWWrLineView() 14 | 15 | @property (nonatomic,strong) CAShapeLayer *wrLineLayer; 16 | @property (nonatomic,strong) NSMutableArray *wrPostionArray; 17 | 18 | @end 19 | 20 | @implementation ZYWWrLineView 21 | 22 | - (void)initLayer 23 | { 24 | if (self.wrLineLayer) 25 | { 26 | [self.wrLineLayer removeFromSuperlayer]; 27 | self.wrLineLayer = nil; 28 | } 29 | 30 | if (!self.wrLineLayer) 31 | { 32 | self.wrLineLayer = [CAShapeLayer layer]; 33 | self.wrLineLayer.frame = CGRectMake(0, 0, CGRectGetWidth(self.frame), CGRectGetHeight(self.frame)); 34 | self.wrLineLayer.lineWidth = self.lineWidth; 35 | self.wrLineLayer.lineCap = kCALineCapRound; 36 | self.wrLineLayer.lineJoin = kCALineJoinRound; 37 | } 38 | [self.layer addSublayer:self.wrLineLayer]; 39 | } 40 | 41 | - (void)initMaxAndMinValue 42 | { 43 | [self layoutIfNeeded]; 44 | self.maxY = CGFLOAT_MIN; 45 | self.minY = CGFLOAT_MAX; 46 | 47 | ZYWLineData *lineData = _dataArray[0]; 48 | NSArray *lineArray = [lineData.data subarrayWithRange:NSMakeRange(_startIndex,_displayCount)]; 49 | for (NSInteger i = 0;i until.value ? self.maxY : until.value; 54 | } 55 | 56 | if (self.maxY - self.minY < 0.5) 57 | { 58 | self.maxY += 0.5; 59 | self.minY += 0.5; 60 | } 61 | self.topMargin = 10; 62 | self.bottomMargin = 5; 63 | 64 | self.scaleY = (self.height - self.topMargin - self.bottomMargin)/(self.maxY-self.minY); 65 | } 66 | 67 | - (void)initLinesModelPosition 68 | { 69 | [self.wrPostionArray removeAllObjects]; 70 | ZYWLineData *lineData = _dataArray.firstObject; 71 | NSArray *array = [lineData.data subarrayWithRange:NSMakeRange(_startIndex,_displayCount)]; 72 | for (NSInteger j = 0;j 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /ZYWChart/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2016/12/17. 6 | // Copyright © 2016年 zyw113. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @property (nonatomic,strong) UITableView *tableView; 14 | @property (nonatomic,copy) NSArray *titlesArray; 15 | 16 | @end 17 | 18 | @implementation ViewController 19 | 20 | - (void)viewDidLoad 21 | { 22 | [super viewDidLoad]; 23 | self.navigationItem.title = @"Demo"; 24 | _tableView = [[UITableView alloc] initWithFrame:self.view.bounds]; 25 | [self.view addSubview:_tableView]; 26 | _tableView.delegate = self; 27 | _tableView.dataSource = self; 28 | _titlesArray = @[@"折线图",@"滑动折线图",@"K线图",@"分时图"]; 29 | } 30 | 31 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 32 | { 33 | return _titlesArray.count; 34 | } 35 | 36 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 37 | { 38 | NSArray *controllers = @[@"LineVC",@"SlipLineVC",@"CandleLineVC",@"TimeLineVC"]; 39 | NSString *vcName = controllers[indexPath.row]; 40 | Class class = NSClassFromString(vcName); 41 | UIViewController *vc = [[class alloc] init]; 42 | [self.navigationController pushViewController:vc animated:YES]; 43 | } 44 | 45 | - (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 46 | { 47 | static NSString *identifier = @"identifier"; 48 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier]; 49 | if (!cell) 50 | { 51 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier]; 52 | cell.selectionStyle = UITableViewCellSelectionStyleNone; 53 | } 54 | 55 | cell.textLabel.text = _titlesArray[indexPath.row]; 56 | return cell; 57 | } 58 | 59 | - (void)didReceiveMemoryWarning { 60 | [super didReceiveMemoryWarning]; 61 | // Dispose of any resources that can be recreated. 62 | } 63 | 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /ZYWChart/ZYWChart-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWChart-Prefix.pch 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2016/12/17. 6 | // Copyright © 2016年 zyw113. All rights reserved. 7 | // 8 | 9 | #ifndef ZYWChart_Prefix_pch 10 | #define ZYWChart_Prefix_pch 11 | 12 | #ifdef __OBJC__ 13 | 14 | #import "Masonry.h" 15 | #import "ZYWLineModel.h" 16 | #import "UIBezierPath+Draw.h" 17 | #import "UIColor+YW.h" 18 | #import "UIView+Extension.h" 19 | #import "ZYWBaseChartView.h" 20 | #import "ZYWCandleModel.h" 21 | 22 | #define DEVICE_HEIGHT [UIScreen mainScreen].bounds.size.height 23 | #define DEVICE_WIDTH [UIScreen mainScreen].bounds.size.width 24 | 25 | #define widthradio DEVICE_WIDTH/375 26 | #define heightradio DEVICE_HEIGHT/667 27 | 28 | #define RoseColor [UIColor colorWithHexString:@"f05b72"] 29 | #define DropColor [UIColor colorWithHexString:@"7fb80e"] 30 | 31 | #define ContentOffSet @"contentOffset" 32 | 33 | #endif 34 | 35 | #endif /* ZYWChart_Prefix_pch */ 36 | -------------------------------------------------------------------------------- /ZYWChart/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // ZYWChart 4 | // 5 | // Created by 张有为 on 2016/12/17. 6 | // Copyright © 2016年 zyw113. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ZYWChart/thridPart/TALib/include/ta_common.h: -------------------------------------------------------------------------------- 1 | /* TA-LIB Copyright (c) 1999-2007, Mario Fortier 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or 5 | * without modification, are permitted provided that the following 6 | * conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * - Neither name of author nor the names of its contributors 17 | * may be used to endorse or promote products derived from this 18 | * software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 30 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 31 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | #ifndef TA_COMMON_H 34 | #define TA_COMMON_H 35 | 36 | /* The following macros are used to return internal errors. 37 | * The Id can be from 1 to 999 and translate to the user 38 | * as the return code 5000 to 5999. 39 | * 40 | * Everytime you wish to add a new fatal error code, 41 | * use the "NEXT AVAILABLE NUMBER" and increment the 42 | * number in this file. 43 | * 44 | * NEXT AVAILABLE NUMBER: 181 45 | */ 46 | #define TA_INTERNAL_ERROR(Id) ((TA_RetCode)(TA_INTERNAL_ERROR+Id)) 47 | 48 | #ifdef __cplusplus 49 | extern "C" { 50 | #endif 51 | 52 | #include 53 | #include 54 | #include 55 | 56 | #ifndef TA_DEFS_H 57 | #include "ta_defs.h" 58 | #endif 59 | 60 | /* Some functions to get the version of TA-Lib. 61 | * 62 | * Format is "Major.Minor.Patch (Month Day Year Hour:Min:Sec)" 63 | * 64 | * Example: "1.2.0 (Jan 17 2004 23:59:59)" 65 | * 66 | * Major increments indicates an "Highly Recommended" update. 67 | * 68 | * Minor increments indicates arbitrary milestones in the 69 | * development of the next major version. 70 | * 71 | * Patch are fixes to a "Major.Minor" release. 72 | */ 73 | const char *TA_GetVersionString( void ); 74 | 75 | /* Get individual component of the Version string */ 76 | const char *TA_GetVersionMajor ( void ); 77 | const char *TA_GetVersionMinor ( void ); 78 | const char *TA_GetVersionBuild ( void ); 79 | const char *TA_GetVersionDate ( void ); 80 | const char *TA_GetVersionTime ( void ); 81 | 82 | /* Misc. declaration used throughout the library code. */ 83 | typedef double TA_Real; 84 | typedef int TA_Integer; 85 | 86 | /* General purpose structure containing an array of string. 87 | * 88 | * Example of usage: 89 | * void printStringTable( TA_StringTable *table ) 90 | * { 91 | * int i; 92 | * for( i=0; i < table->size; i++ ) 93 | * cout << table->string[i] << endl; 94 | * } 95 | * 96 | */ 97 | typedef struct TA_StringTable 98 | { 99 | unsigned int size; /* Number of string. */ 100 | const char **string; /* Pointer to the strings. */ 101 | 102 | /* Hidden data for internal use by TA-Lib. Do not modify. */ 103 | void *hiddenData; 104 | } TA_StringTable; 105 | /* End-user can get additional information related to a TA_RetCode. 106 | * 107 | * Example: 108 | * TA_RetCodeInfo info; 109 | * 110 | * retCode = TA_Initialize( ... ); 111 | * 112 | * if( retCode != TA_SUCCESS ) 113 | * { 114 | * TA_SetRetCodeInfo( retCode, &info ); 115 | * printf( "Error %d(%s): %s\n", 116 | * retCode, 117 | * info.enumStr, 118 | * info.infoStr ); 119 | * } 120 | * 121 | * Would display: 122 | * "Error 1(TA_LIB_NOT_INITIALIZE): TA_Initialize was not sucessfully called" 123 | */ 124 | typedef struct TA_RetCodeInfo 125 | { 126 | const char *enumStr; /* Like "TA_IP_SOCKETERROR" */ 127 | const char *infoStr; /* Like "Error creating socket" */ 128 | } TA_RetCodeInfo; 129 | 130 | /* Info is always returned, even when 'theRetCode' is invalid. */ 131 | void TA_SetRetCodeInfo( TA_RetCode theRetCode, TA_RetCodeInfo *retCodeInfo ); 132 | 133 | /* TA_Initialize() initialize the ressources used by TA-Lib. This 134 | * function must be called once prior to any other functions declared in 135 | * this file. 136 | * 137 | * TA_Shutdown() allows to free all ressources used by TA-Lib. Following 138 | * a shutdown, TA_Initialize() must be called again for re-using TA-Lib. 139 | * 140 | * TA_Shutdown() should be called prior to exiting the application code. 141 | */ 142 | TA_RetCode TA_Initialize( void ); 143 | TA_RetCode TA_Shutdown( void ); 144 | 145 | #ifdef __cplusplus 146 | } 147 | #endif 148 | 149 | #endif 150 | -------------------------------------------------------------------------------- /ZYWChart/thridPart/TALib/include/ta_libc.h: -------------------------------------------------------------------------------- 1 | /* TA-LIB Copyright (c) 1999-2007, Mario Fortier 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or 5 | * without modification, are permitted provided that the following 6 | * conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * - Neither name of author nor the names of its contributors 17 | * may be used to endorse or promote products derived from this 18 | * software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 30 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 31 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | #ifndef TA_LIBC_H 34 | #define TA_LIBC_H 35 | 36 | /* Includes all headers needed for using the ta-lib 'C' library. */ 37 | 38 | #ifndef TA_COMMON_H 39 | #include "ta_common.h" 40 | #endif 41 | 42 | #ifndef TA_FUNC_H 43 | #include "ta_func.h" 44 | #endif 45 | 46 | #ifndef TA_ABSTRACT_H 47 | #include "ta_abstract.h" 48 | #endif 49 | 50 | #endif 51 | 52 | -------------------------------------------------------------------------------- /ZYWChart/thridPart/TALib/src/ta_common/ta_global.h: -------------------------------------------------------------------------------- 1 | #ifndef TA_GLOBAL_H 2 | #define TA_GLOBAL_H 3 | 4 | #ifndef TA_COMMON_H 5 | #include "ta_common.h" 6 | #endif 7 | 8 | #ifndef TA_FUNC_H 9 | #include "ta_func.h" 10 | #endif 11 | 12 | /* TA_CandleSetting is the one setting struct */ 13 | typedef struct { 14 | TA_CandleSettingType settingType; 15 | TA_RangeType rangeType; 16 | int avgPeriod; 17 | double factor; 18 | } TA_CandleSetting; 19 | 20 | /* This interface is used exclusively INTERNALY to the TA-LIB. 21 | * There is nothing for the end-user here ;-> 22 | */ 23 | 24 | /* Provides functionality for managing global ressource 25 | * throughout the TA-LIB. 26 | * 27 | * Since not all module are used/link in the application, 28 | * the ta_common simply provides the mechanism for the module 29 | * to optionnaly "register" its initialization/shutdown 30 | * function. 31 | * 32 | * A function shall access its global variable by calling 33 | * TA_GetGlobal. This function will appropriatly call the 34 | * initialization function if its global are not yet initialized. 35 | * 36 | * The call of the init and shutdown function are guaranteed 37 | * to be multithread protected. It is also guarantee that 38 | * these function will always get called in alternance (in 39 | * other word, following an initialization only a shutdown 40 | * can get called). 41 | */ 42 | 43 | typedef enum 44 | { 45 | /* Module will be shutdown in the order specified here. */ 46 | 47 | TA_ABSTRACTION_GLOBAL_ID, 48 | TA_FUNC_GLOBAL_ID, 49 | TA_MEMORY_GLOBAL_ID, /* Must be last. */ 50 | TA_NB_GLOBAL_ID 51 | } TA_GlobalModuleId; 52 | 53 | typedef TA_RetCode (*TA_GlobalInitFunc) ( void **globalToAlloc ); 54 | typedef TA_RetCode (*TA_GlobalShutdownFunc)( void *globalAllocated ); 55 | 56 | typedef struct 57 | { 58 | const TA_GlobalModuleId id; 59 | const TA_GlobalInitFunc init; 60 | const TA_GlobalShutdownFunc shutdown; 61 | } TA_GlobalControl; 62 | 63 | TA_RetCode TA_GetGlobal( const TA_GlobalControl * const control, 64 | void **global ); 65 | 66 | /* Occasionaly, code tracing must be disable. 67 | * Example: 68 | * - The memory module needs to know if the tracing is 69 | * still enabled or not when freeing memory on shutdown. 70 | * - We do not want to recursively trace while the tracing 71 | * function themselves gets called ;-> 72 | */ 73 | int TA_IsTraceEnabled( void ); 74 | void TA_TraceEnable ( void ); 75 | void TA_TraceDisable ( void ); 76 | 77 | /* If enabled by the user, use a local drive 78 | * for configuration and/or temporary file. 79 | * TA-LIB must NEVER assume such local drive 80 | * is available. 81 | */ 82 | const char *TA_GetLocalCachePath( void ); 83 | 84 | typedef struct 85 | { 86 | unsigned int initialize; 87 | const TA_GlobalControl * control; 88 | void *global; 89 | } TA_ModuleControl; 90 | 91 | /* This is the hidden implementation of TA_Libc. */ 92 | typedef struct 93 | { 94 | unsigned int magicNb; /* Unique identifier of this object. */ 95 | TA_ModuleControl moduleControl[TA_NB_GLOBAL_ID]; 96 | 97 | unsigned int traceEnabled; 98 | unsigned int stdioEnabled; 99 | FILE *stdioFile; 100 | 101 | const char *localCachePath; 102 | 103 | /* For handling the compatibility with other software */ 104 | TA_Compatibility compatibility; 105 | 106 | /* For handling the unstable period of some TA function. */ 107 | unsigned int unstablePeriod[TA_FUNC_UNST_ALL]; 108 | 109 | /* For handling the candlestick global settings */ 110 | TA_CandleSetting candleSettings[TA_AllCandleSettings]; 111 | 112 | } TA_LibcPriv; 113 | 114 | /* The following global is used all over the place 115 | * and is the entry point for all other globals. 116 | */ 117 | extern TA_LibcPriv *TA_Globals; 118 | 119 | #endif 120 | -------------------------------------------------------------------------------- /ZYWChart/thridPart/TALib/src/ta_common/ta_magic_nb.h: -------------------------------------------------------------------------------- 1 | #ifndef TA_MAGIC_NB_H 2 | #define TA_MAGIC_NB_H 3 | 4 | /* Many allocated structures contains a magic number. 5 | * 6 | * These numbers are used solely to make sure that when a pointer is 7 | * provided, it is really pointing on the expected type of data. 8 | * It helps also for the detection of memory corruption. 9 | * This mechanism is simple, but add a non-negligeable level of 10 | * reliability at a very low cost (speed/memory wise). 11 | */ 12 | #define TA_FUNC_DEF_MAGIC_NB 0xA201B201 13 | #define TA_PARAM_HOLDER_PRIV_MAGIC_NB 0xA202B202 14 | #define TA_LIBC_PRIV_MAGIC_NB 0xA203B203 15 | #define TA_UDBASE_MAGIC_NB 0xA204B204 16 | #define TA_CATEGORY_TABLE_MAGIC_NB 0xA205B205 17 | #define TA_SYMBOL_TABLE_MAGIC_NB 0xA206B206 18 | #define TA_WEBPAGE_MAGIC_NB 0xA207B207 19 | #define TA_STREAM_MAGIC_NB 0xA208B208 20 | #define TA_STREAM_ACCESS_MAGIC_NB 0xA209B209 21 | #define TA_YAHOO_IDX_MAGIC_NB 0xA20AB20A 22 | #define TA_STRING_TABLE_GROUP_MAGIC_NB 0xA20BB20B 23 | #define TA_STRING_TABLE_FUNC_MAGIC_NB 0xA20CB20C 24 | #define TA_MARKET_PAGE_MAGIC_NB 0xA20DB20D 25 | #define TA_TRADELOGPRIV_MAGIC_NB 0xA20EB20E 26 | #define TA_PMPRIV_MAGIC_NB 0xA20FB20F 27 | #define TA_PMREPORT_MAGIC_NB 0xA210B210 28 | #define TA_TRADEREPORT_MAGIC_NB 0xA211B211 29 | #define TA_HISTORY_MAGIC_NB 0xA212B212 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /ZYWChart/thridPart/TALib/src/ta_common/ta_pragma.h: -------------------------------------------------------------------------------- 1 | /* TA-LIB Copyright (c) 1999-2007, Mario Fortier 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or 5 | * without modification, are permitted provided that the following 6 | * conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * - Neither name of author nor the names of its contributors 17 | * may be used to endorse or promote products derived from this 18 | * software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 30 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 31 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /* List of contributors: 35 | * 36 | * Initial Name/description 37 | * ------------------------------------------------------------------- 38 | * CM Craig Miller (c-miller@users.sourceforge.net) 39 | * 40 | * Change history: 41 | * 42 | * MMDDYY BY Description 43 | * ------------------------------------------------------------------- 44 | * 011707 CM First version. 45 | */ 46 | 47 | /* Description: 48 | * 49 | * Visual Studio 2005 has extended the C Run-Time Library by including "secure" 50 | * runtime functions and deprecating the previous function prototypes. Since 51 | * we need to use the previous prototypes to maintain compatibility with other 52 | * platform compilers we are going to disable the deprecation warnings when 53 | * compiling with Visual Studio 2005. 54 | * 55 | * Note: this header must be the first inclusion referenced by the code file 56 | * needing these settings!!!!! 57 | * 58 | */ 59 | 60 | #ifndef TA_PRAGMA_H 61 | #define TA_PRAGMA_H 62 | 63 | #if (_MSC_VER >= 1400) // VC8+ nmake and VS2005 64 | 65 | #ifndef _CRT_SECURE_NO_DEPRECATE //turn off MS 'safe' CRT library routines 66 | #define _CRT_SECURE_NO_DEPRECATE 1 67 | #endif 68 | 69 | // There are additional macros that may be needed in the future, so we'll list them here 70 | //#ifndef _CRT_SECURE_NO_WARNINGS //turn off MS 'safe' CRT library routines 71 | // #define _CRT_SECURE_NO_WARNINGS 1 72 | //#endif 73 | // 74 | //#ifndef _SCL_SECURE_NO_DEPRECATE //turn off MS 'safe' C++RT library routines 75 | // #define _SCL_SECURE_NO_DEPRECATE 1 76 | //#endif 77 | //#ifndef _SCL_SECURE_NO_WARNINGS 78 | // #define _SCL_SECURE_NO_WARNINGS 1 79 | //#endif 80 | // 81 | //#ifndef _CRT_NONSTDC_NO_DEPRECATE //turn off MS POSIX replacements library routines 82 | // #define _CRT_NONSTDC_NO_DEPRECATE 1 83 | //#endif 84 | 85 | #endif // VC8+ 86 | 87 | #endif //TA_PRAGMA_H 88 | -------------------------------------------------------------------------------- /ZYWChart/thridPart/TALib/src/ta_common/ta_retcode.c: -------------------------------------------------------------------------------- 1 | /* TA-LIB Copyright (c) 1999-2007, Mario Fortier 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or 5 | * without modification, are permitted provided that the following 6 | * conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * - Neither name of author nor the names of its contributors 17 | * may be used to endorse or promote products derived from this 18 | * software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 30 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 31 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /* Important: This file is automatically generated by the utility gen_code. 35 | * Any modification will be lost on next execution of gen_code. 36 | * 37 | * The goal of this file is to provide the functionality TA_SetRetCodeInfo. 38 | * 39 | * This function is a convenient way for the user to translate a TA_RetCode into 40 | * a human readable string. 41 | */ 42 | #include "ta_common.h" 43 | 44 | typedef struct 45 | { 46 | TA_RetCode retCode; 47 | const char * const enumStr; 48 | const char * const infoStr; 49 | } TA_InternalRetCodeInfo; 50 | 51 | static TA_InternalRetCodeInfo retCodeInfoTable[] = { 52 | {(TA_RetCode)0,"TA_SUCCESS","No error"}, 53 | {(TA_RetCode)1,"TA_LIB_NOT_INITIALIZE","TA_Initialize was not sucessfully called"}, 54 | {(TA_RetCode)2,"TA_BAD_PARAM","A parameter is out of range"}, 55 | {(TA_RetCode)3,"TA_ALLOC_ERR","Possibly out-of-memory"}, 56 | {(TA_RetCode)4,"TA_GROUP_NOT_FOUND","No Info"}, 57 | {(TA_RetCode)5,"TA_FUNC_NOT_FOUND","No Info"}, 58 | {(TA_RetCode)6,"TA_INVALID_HANDLE","No Info"}, 59 | {(TA_RetCode)7,"TA_INVALID_PARAM_HOLDER","No Info"}, 60 | {(TA_RetCode)8,"TA_INVALID_PARAM_HOLDER_TYPE","No Info"}, 61 | {(TA_RetCode)9,"TA_INVALID_PARAM_FUNCTION","No Info"}, 62 | {(TA_RetCode)10,"TA_INPUT_NOT_ALL_INITIALIZE","No Info"}, 63 | {(TA_RetCode)11,"TA_OUTPUT_NOT_ALL_INITIALIZE","No Info"}, 64 | {(TA_RetCode)12,"TA_OUT_OF_RANGE_START_INDEX","No Info"}, 65 | {(TA_RetCode)13,"TA_OUT_OF_RANGE_END_INDEX","No Info"}, 66 | {(TA_RetCode)14,"TA_INVALID_LIST_TYPE","No Info"}, 67 | {(TA_RetCode)15,"TA_BAD_OBJECT","No Info"}, 68 | {(TA_RetCode)16,"TA_NOT_SUPPORTED","No Info"}, 69 | {(TA_RetCode)5000,"TA_INTERNAL_ERROR","No Info"}, 70 | {(TA_RetCode)0xFFFF,"TA_UNKNOWN_ERR","Unknown Error"} 71 | }; 72 | 73 | #define NB_RET_CODE_INFO (sizeof(retCodeInfoTable)/sizeof(TA_InternalRetCodeInfo)) 74 | 75 | void TA_SetRetCodeInfo( TA_RetCode theRetCode, TA_RetCodeInfo *retCodeInfo ) 76 | { 77 | unsigned int i; 78 | 79 | /* Trap internal error code */ 80 | if( (theRetCode >= 5000) && (theRetCode <= 5999) ) 81 | { 82 | retCodeInfo->enumStr = "TA_INTERNAL_ERROR"; 83 | retCodeInfo->infoStr = "Unexpected Internal Error - Contact TA-Lib.org"; 84 | return; 85 | } 86 | 87 | /* Check among all the error code defined in ta_common.h */ 88 | for( i=0; i < (NB_RET_CODE_INFO-1); i++ ) 89 | { 90 | if( theRetCode == retCodeInfoTable[i].retCode ) 91 | { 92 | /* Error code found. */ 93 | retCodeInfo->enumStr = retCodeInfoTable[i].enumStr; 94 | retCodeInfo->infoStr = retCodeInfoTable[i].infoStr; 95 | return; 96 | } 97 | } 98 | 99 | /* Error code not found. */ 100 | 101 | /* "TA_UNKNOWN_ERR" is ALWAYS the last entry in the table. */ 102 | retCodeInfo->enumStr = retCodeInfoTable[i].enumStr; 103 | retCodeInfo->infoStr = retCodeInfoTable[i].infoStr; 104 | } 105 | 106 | /***************/ 107 | /* End of File */ 108 | /***************/ 109 | 110 | -------------------------------------------------------------------------------- /ZYWChart/thridPart/TALib/src/ta_common/ta_retcode.csv: -------------------------------------------------------------------------------- 1 | 0,TA_SUCCESS,No error 2 | 1,TA_LIB_NOT_INITIALIZE,TA_Initialize was not sucessfully called 3 | 2,TA_BAD_PARAM,A parameter is out of range 4 | 3,TA_ALLOC_ERR,Possibly out-of-memory 5 | 4,TA_GROUP_NOT_FOUND,No Info 6 | 5,TA_FUNC_NOT_FOUND,No Info 7 | 6,TA_INVALID_HANDLE,No Info 8 | 7,TA_INVALID_PARAM_HOLDER,No Info 9 | 8,TA_INVALID_PARAM_HOLDER_TYPE,No Info 10 | 9,TA_INVALID_PARAM_FUNCTION,No Info 11 | 10,TA_INPUT_NOT_ALL_INITIALIZE,No Info 12 | 11,TA_OUTPUT_NOT_ALL_INITIALIZE,No Info 13 | 12,TA_OUT_OF_RANGE_START_INDEX,No Info 14 | 13,TA_OUT_OF_RANGE_END_INDEX,No Info 15 | 14,TA_INVALID_LIST_TYPE,No Info 16 | 15,TA_BAD_OBJECT,No Info 17 | 16,TA_NOT_SUPPORTED,No Info 18 | 5000,TA_INTERNAL_ERROR,No Info 19 | -------------------------------------------------------------------------------- /ZYWChart/thridPart/TALib/src/ta_common/ta_version.c: -------------------------------------------------------------------------------- 1 | /* TA-LIB Copyright (c) 1999-2007, Mario Fortier 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or 5 | * without modification, are permitted provided that the following 6 | * conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * - Neither name of author nor the names of its contributors 17 | * may be used to endorse or promote products derived from this 18 | * software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 30 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 31 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #include 35 | #include 36 | 37 | /* Version number controlled manually. 38 | * 39 | * Should be modified only by TA-Lib.org 40 | */ 41 | #define MAJOR "0" 42 | #define MINOR "4" 43 | #define BUILD "0" 44 | 45 | /* Nothing to modify below this line. */ 46 | 47 | #define TA_VERSION_STRING(maj,min,build,date,time) maj"."min"."build" ("date" "time")" 48 | 49 | const char *TA_GetVersionString( void ) 50 | { 51 | return TA_VERSION_STRING(MAJOR,MINOR,BUILD,__DATE__,__TIME__); 52 | } 53 | 54 | const char *TA_GetVersionMajor( void ) 55 | { 56 | return MAJOR; 57 | } 58 | 59 | const char *TA_GetVersionMinor( void ) 60 | { 61 | return MINOR; 62 | } 63 | 64 | const char *TA_GetVersionBuild( void ) 65 | { 66 | return BUILD; 67 | } 68 | 69 | const char *TA_GetVersionDate( void ) 70 | { 71 | return __DATE__; 72 | } 73 | 74 | const char *TA_GetVersionTime( void ) 75 | { 76 | return __TIME__; 77 | } 78 | -------------------------------------------------------------------------------- /ZYWChart/thridPart/TALib/src/ta_func/ta_utility.c: -------------------------------------------------------------------------------- 1 | /* TA-LIB Copyright (c) 1999-2007, Mario Fortier 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or 5 | * without modification, are permitted provided that the following 6 | * conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * - Neither name of author nor the names of its contributors 17 | * may be used to endorse or promote products derived from this 18 | * software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 30 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 31 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /* List of contributors: 35 | * 36 | * Initial Name/description 37 | * ------------------------------------------------------------------- 38 | * MF Mario Fortier 39 | * RM Robert Meier (talib@meierlim.com http://www.meierlim.com) 40 | * 41 | * Change history: 42 | * 43 | * MMDDYY BY Description 44 | * ------------------------------------------------------------------- 45 | * 052603 MF Adapt code to compile with .NET Managed C++ 46 | * 123004 RM,MF Adapt code to work with Visual Studio 2005 47 | * 48 | */ 49 | 50 | #if defined( _MANAGED ) 51 | #using 52 | #include "TA-Lib-Core.h" 53 | #include "ta_memory.h" 54 | namespace TicTacTec { namespace TA { namespace Library { 55 | #else 56 | #include "ta_utility.h" 57 | #include "ta_func.h" 58 | #include "ta_memory.h" 59 | #endif 60 | 61 | #if defined( _MANAGED ) 62 | enum class Core::RetCode Core::SetUnstablePeriod( enum class FuncUnstId id, 63 | unsigned int unstablePeriod ) 64 | #else 65 | TA_RetCode TA_SetUnstablePeriod( TA_FuncUnstId id, 66 | unsigned int unstablePeriod ) 67 | #endif 68 | { 69 | int i; 70 | 71 | if( id > ENUM_VALUE(FuncUnstId,TA_FUNC_UNST_ALL,FuncUnstAll) ) 72 | return ENUM_VALUE(RetCode,TA_BAD_PARAM,BadParam); 73 | 74 | if( id == ENUM_VALUE(FuncUnstId,TA_FUNC_UNST_ALL,FuncUnstAll) ) 75 | { 76 | for( i=0; i < (int)ENUM_VALUE(FuncUnstId,TA_FUNC_UNST_ALL,FuncUnstAll); i++ ) 77 | { 78 | #if defined( _MANAGED ) 79 | Globals->unstablePeriod[(int)i] = unstablePeriod; 80 | #else 81 | TA_Globals->unstablePeriod[i] = unstablePeriod; 82 | #endif 83 | } 84 | } 85 | else 86 | { 87 | #if defined( _MANAGED ) 88 | Globals->unstablePeriod[(int)id] = unstablePeriod; 89 | #else 90 | TA_Globals->unstablePeriod[id] = unstablePeriod; 91 | #endif 92 | } 93 | 94 | return ENUM_VALUE(RetCode,TA_SUCCESS,Success); 95 | } 96 | 97 | #if defined( _MANAGED ) 98 | unsigned int Core::GetUnstablePeriod( enum class FuncUnstId id ) 99 | #else 100 | unsigned int TA_GetUnstablePeriod( TA_FuncUnstId id ) 101 | #endif 102 | { 103 | if( id >= ENUM_VALUE(FuncUnstId,TA_FUNC_UNST_ALL,FuncUnstAll) ) 104 | return 0; 105 | 106 | #if defined( _MANAGED ) 107 | return Globals->unstablePeriod[(int)id]; 108 | #else 109 | return TA_Globals->unstablePeriod[id]; 110 | #endif 111 | } 112 | 113 | #if defined( _MANAGED ) 114 | enum class Core::RetCode Core::SetCompatibility( enum class Compatibility value ) 115 | #else 116 | TA_RetCode TA_SetCompatibility( TA_Compatibility value ) 117 | #endif 118 | { 119 | TA_GLOBALS_COMPATIBILITY = value; 120 | return ENUM_VALUE(RetCode,TA_SUCCESS,Success); 121 | } 122 | 123 | #if defined( _MANAGED ) 124 | enum class Core::Compatibility Core::GetCompatibility( void ) 125 | #else 126 | TA_Compatibility TA_GetCompatibility( void ) 127 | #endif 128 | { 129 | return TA_GLOBALS_COMPATIBILITY; 130 | } 131 | 132 | #if defined( _MANAGED ) 133 | }}} // Close namespace TicTacTec::TA::Lib 134 | #endif 135 | -------------------------------------------------------------------------------- /ZYWChartTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /ZYWChartTests/ZYWChartTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWChartTests.m 3 | // ZYWChartTests 4 | // 5 | // Created by 张有为 on 2016/12/17. 6 | // Copyright © 2016年 zyw113. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ZYWChartTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation ZYWChartTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /ZYWChartUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /ZYWChartUITests/ZYWChartUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZYWChartUITests.m 3 | // ZYWChartUITests 4 | // 5 | // Created by 张有为 on 2016/12/17. 6 | // Copyright © 2016年 zyw113. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ZYWChartUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation ZYWChartUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /resourse/demo1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zyw113/ZYWStock/9135b7ee174de2e2c2c5307c1dbea49da2889d12/resourse/demo1.gif -------------------------------------------------------------------------------- /resourse/demo2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zyw113/ZYWStock/9135b7ee174de2e2c2c5307c1dbea49da2889d12/resourse/demo2.gif -------------------------------------------------------------------------------- /resourse/demo3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zyw113/ZYWStock/9135b7ee174de2e2c2c5307c1dbea49da2889d12/resourse/demo3.gif -------------------------------------------------------------------------------- /resourse/demo4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zyw113/ZYWStock/9135b7ee174de2e2c2c5307c1dbea49da2889d12/resourse/demo4.gif -------------------------------------------------------------------------------- /resourse/demo5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zyw113/ZYWStock/9135b7ee174de2e2c2c5307c1dbea49da2889d12/resourse/demo5.gif -------------------------------------------------------------------------------- /resourse/demo6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zyw113/ZYWStock/9135b7ee174de2e2c2c5307c1dbea49da2889d12/resourse/demo6.gif -------------------------------------------------------------------------------- /resourse/img1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zyw113/ZYWStock/9135b7ee174de2e2c2c5307c1dbea49da2889d12/resourse/img1.png -------------------------------------------------------------------------------- /resourse/img2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zyw113/ZYWStock/9135b7ee174de2e2c2c5307c1dbea49da2889d12/resourse/img2.png --------------------------------------------------------------------------------