├── RRStock ├── RRStock │ ├── test6.gif │ ├── test8.gif │ ├── Assets.xcassets │ │ ├── Contents.json │ │ ├── navigationBarBg.imageset │ │ │ ├── navigationBarBg@2x.png │ │ │ └── Contents.json │ │ ├── compose_photo_close.imageset │ │ │ ├── compose_photo_close@2x.png │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── navigationBarBg@2x.png │ ├── compose_photo_close@2x.png │ ├── Stock │ │ ├── View │ │ │ ├── HYStockChart │ │ │ │ ├── StockChartView │ │ │ │ │ ├── .DS_Store │ │ │ │ │ ├── StockChartProfileModel │ │ │ │ │ │ ├── HYStockChartProfileModel.m │ │ │ │ │ │ └── HYStockChartProfileModel.h │ │ │ │ │ ├── StockProfileView │ │ │ │ │ │ ├── TimeLineLongPressProfileView │ │ │ │ │ │ │ ├── HYTimeLineLongPressView.h │ │ │ │ │ │ │ ├── HYTimeLineLongPressProfileView.h │ │ │ │ │ │ │ ├── HYTimeLineLongPressView.m │ │ │ │ │ │ │ └── HYTimeLineLongPressProfileView.m │ │ │ │ │ │ ├── BrokenLineLongPressProfileView │ │ │ │ │ │ │ ├── HYBrokenLineLongPressView.h │ │ │ │ │ │ │ ├── HYBrokenLineLongPressProfileView.h │ │ │ │ │ │ │ ├── HYBrokenLineLongPressView.m │ │ │ │ │ │ │ └── HYBrokenLineLongPressProfileView.m │ │ │ │ │ │ ├── KLineLongPressProfileView │ │ │ │ │ │ │ ├── HYKLineLongPressView.h │ │ │ │ │ │ │ ├── HYKLineLongPressProfileView.h │ │ │ │ │ │ │ ├── HYKLineLongPressView.m │ │ │ │ │ │ │ └── HYKLineLongPressProfileView.m │ │ │ │ │ │ └── DefaultProfileView │ │ │ │ │ │ │ ├── HYStoctDefaultProfileView.h │ │ │ │ │ │ │ └── HYStoctDefaultProfileView.m │ │ │ │ │ ├── SegmentView │ │ │ │ │ │ └── HYStockChartSegmentView.h │ │ │ │ │ └── HYStockChartView.h │ │ │ │ ├── TimeLine │ │ │ │ │ ├── FiveRangeCell.h │ │ │ │ │ ├── TradeDetailCell.h │ │ │ │ │ ├── TradeDetailTableView.h │ │ │ │ │ ├── FiveRangeTableView.h │ │ │ │ │ ├── AboveView │ │ │ │ │ │ ├── HYTimeLineAbovePositionModel.m │ │ │ │ │ │ ├── HYTimeLineAbovePositionModel.h │ │ │ │ │ │ ├── YYTimeLineMaskView.h │ │ │ │ │ │ ├── HYTimeLine.h │ │ │ │ │ │ └── HYTimeLineAboveView.h │ │ │ │ │ ├── BelowView │ │ │ │ │ │ ├── HYTimeLineBelowPositionModel.m │ │ │ │ │ │ ├── HYTimeLineBelowPositionModel.h │ │ │ │ │ │ ├── YYTimeLineBelowMaskView.h │ │ │ │ │ │ ├── HYTimeLineVolume.h │ │ │ │ │ │ ├── HYTimeLineBelowView.h │ │ │ │ │ │ ├── HYTimeLineVolume.m │ │ │ │ │ │ └── YYTimeLineBelowMaskView.m │ │ │ │ │ ├── UIView+HXCircleAnimation.h │ │ │ │ │ ├── TimeLineModel │ │ │ │ │ │ ├── HYTimeLineGroupModel.h │ │ │ │ │ │ ├── HYTimeLineModel.h │ │ │ │ │ │ ├── HYTimeLineGroupModel.m │ │ │ │ │ │ └── HYTimeLineModel.m │ │ │ │ │ ├── HYTimeLineView.h │ │ │ │ │ ├── TradeDetailTableView.m │ │ │ │ │ ├── FiveRangeCell.m │ │ │ │ │ ├── TradeDetailCell.m │ │ │ │ │ ├── FiveRangeTableView.m │ │ │ │ │ └── UIView+HXCircleAnimation.m │ │ │ │ ├── KLine │ │ │ │ │ ├── AboveView │ │ │ │ │ │ ├── HYKLineAboveAxisMaskView.h │ │ │ │ │ │ ├── HYKLineAboveAxisMaskView.m │ │ │ │ │ │ ├── HYMALine.h │ │ │ │ │ │ ├── HYKLinePositionModel.m │ │ │ │ │ │ ├── HYKLine.h │ │ │ │ │ │ ├── HYKLinePositionModel.h │ │ │ │ │ │ ├── HYMALine.m │ │ │ │ │ │ └── HYKLineAboveView.h │ │ │ │ │ ├── KLineDetailView │ │ │ │ │ │ ├── HYKLineDetailView.h │ │ │ │ │ │ ├── HYKLineDetailView.m │ │ │ │ │ │ └── HYKLineDetailView.xib │ │ │ │ │ ├── BelowView │ │ │ │ │ │ ├── HYKLineVolumePositionModel.h │ │ │ │ │ │ ├── HYKLineVolumePositionModel.m │ │ │ │ │ │ ├── HYKLineVolume.h │ │ │ │ │ │ ├── HYKLineBelowView.h │ │ │ │ │ │ └── HYKLineVolume.m │ │ │ │ │ ├── HYKLineView.h │ │ │ │ │ ├── MAView │ │ │ │ │ │ ├── HYKLineMAView.h │ │ │ │ │ │ └── HYKLineMAView.m │ │ │ │ │ └── KLineModel │ │ │ │ │ │ ├── HYKLineModel.m │ │ │ │ │ │ └── HYKLineModel.h │ │ │ │ ├── HYStockChartTool │ │ │ │ │ ├── HYStockChartTool.h │ │ │ │ │ └── HYStockChartTool.m │ │ │ │ ├── Category │ │ │ │ │ ├── NSDateFormatter+HYStockChart │ │ │ │ │ │ ├── NSDateFormatter+HYStockChart.h │ │ │ │ │ │ └── NSDateFormatter+HYStockChart.m │ │ │ │ │ ├── UIFont+Extension │ │ │ │ │ │ └── UIFont+HYStockChart.h │ │ │ │ │ └── UIColor+HYStockChart │ │ │ │ │ │ ├── UIColor+HYStockChart.h │ │ │ │ │ │ └── UIColor+HYStockChart.m │ │ │ │ ├── HYStockChart.h │ │ │ │ ├── StockChartYView │ │ │ │ │ ├── HYStockChartYView.h │ │ │ │ │ └── HYStockChartYView.m │ │ │ │ ├── GloablVariable │ │ │ │ │ ├── HYStockChartGloablVariable.h │ │ │ │ │ └── HYStockChartGloablVariable.m │ │ │ │ └── Constant 下午3.56.37 │ │ │ │ │ ├── HYStockChartConstant.m │ │ │ │ │ └── HYStockChartConstant.h │ │ │ ├── StockDetailTopView.h │ │ │ ├── StockDetailBottomView.h │ │ │ ├── IgnoreHeaderTouchTableView.h │ │ │ ├── RecognizeSimultaneousTableView.h │ │ │ ├── StockContentView.h │ │ │ ├── StockDetailHeaderView.h │ │ │ ├── StockDetailBottomView.m │ │ │ ├── StockChartTitleView.h │ │ │ ├── RecognizeSimultaneousTableView.m │ │ │ ├── IgnoreHeaderTouchTableView.m │ │ │ └── StockContentView.m │ │ ├── Tools │ │ │ ├── UIButton+CZ │ │ │ │ ├── CustomButton.h │ │ │ │ ├── UIButton+CZ.h │ │ │ │ ├── CustomButton.m │ │ │ │ └── UIButton+CZ.m │ │ │ ├── UILabel+CZ │ │ │ │ ├── CustomLabel.h │ │ │ │ └── CustomLabel.m │ │ │ ├── UIView+Extension │ │ │ │ ├── UIView+Extension.h │ │ │ │ └── UIView+Extension.m │ │ │ └── UIColor+CZ │ │ │ │ └── UIColor+Utils.h │ │ ├── Model │ │ │ ├── KLineModel │ │ │ │ ├── JMSKLineModel.m │ │ │ │ ├── JMSKLineGroupModel.m │ │ │ │ ├── JMSKLineGroupModel.h │ │ │ │ └── JMSKLineModel.h │ │ │ ├── TimeLineModel │ │ │ │ ├── JMSTimeLineModel.m │ │ │ │ ├── JMSGroupTimeLineModel.m │ │ │ │ ├── JMSGroupTimeLineModel.h │ │ │ │ └── JMSTimeLineModel.h │ │ │ └── MJExtension │ │ │ │ ├── NSString+MJExtension.h │ │ │ │ ├── MJFoundation.h │ │ │ │ ├── NSString+MJExtension.m │ │ │ │ ├── MJExtension.h │ │ │ │ ├── MJConst.m │ │ │ │ ├── MJType.h │ │ │ │ ├── NSObject+MJCoding.h │ │ │ │ ├── MJFoundation.m │ │ │ │ ├── NSObject+MJCoding.m │ │ │ │ ├── MJProperty.h │ │ │ │ ├── MJType.m │ │ │ │ ├── MJConst.h │ │ │ │ ├── NSObject+MJProperty.h │ │ │ │ └── MJProperty.m │ │ └── Controller │ │ │ ├── StockNewsController.h │ │ │ ├── StockTradeController.h │ │ │ ├── StockNoticeController.h │ │ │ ├── StockDataController.h │ │ │ ├── StockOpinionController.h │ │ │ ├── StockInfoDetailViewController.h │ │ │ ├── StockResearchReportController.h │ │ │ ├── HYStockChartViewController.h │ │ │ ├── ArtTableViewController.h │ │ │ └── RRStockChartView.h │ ├── Masonry │ │ ├── Masonry │ │ │ ├── MASLayoutConstraint.m │ │ │ ├── NSLayoutConstraint+MASDebugAdditions.h │ │ │ ├── MASLayoutConstraint.h │ │ │ ├── MASCompositeConstraint.h │ │ │ ├── Masonry.h │ │ │ ├── ViewController+MASAdditions.h │ │ │ ├── NSArray+MASShorthandAdditions.h │ │ │ ├── MASViewAttribute.m │ │ │ ├── MASViewAttribute.h │ │ │ ├── ViewController+MASAdditions.m │ │ │ ├── MASViewConstraint.h │ │ │ ├── MASConstraint+Private.h │ │ │ ├── NSArray+MASAdditions.h │ │ │ ├── View+MASShorthandAdditions.h │ │ │ └── View+MASAdditions.h │ │ └── LICENSE │ ├── AppDelegate.h │ ├── main.m │ ├── DetailViewController.h │ ├── MasterViewController.h │ ├── RRStock_PrefixHeader.pch │ ├── DetailViewController.m │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ ├── Info.plist │ ├── MasterViewController.m │ └── AppDelegate.m ├── RRStock.xcodeproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── RRStockTests │ ├── Info.plist │ └── RRStockTests.m └── RRStockUITests │ ├── Info.plist │ └── RRStockUITests.m ├── README.md └── .gitignore /RRStock/RRStock/test6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingluanchou/RRStock/HEAD/RRStock/RRStock/test6.gif -------------------------------------------------------------------------------- /RRStock/RRStock/test8.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingluanchou/RRStock/HEAD/RRStock/RRStock/test8.gif -------------------------------------------------------------------------------- /RRStock/RRStock/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /RRStock/RRStock/navigationBarBg@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingluanchou/RRStock/HEAD/RRStock/RRStock/navigationBarBg@2x.png -------------------------------------------------------------------------------- /RRStock/RRStock/compose_photo_close@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingluanchou/RRStock/HEAD/RRStock/RRStock/compose_photo_close@2x.png -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/StockChartView/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingluanchou/RRStock/HEAD/RRStock/RRStock/Stock/View/HYStockChart/StockChartView/.DS_Store -------------------------------------------------------------------------------- /RRStock/RRStock/Assets.xcassets/navigationBarBg.imageset/navigationBarBg@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingluanchou/RRStock/HEAD/RRStock/RRStock/Assets.xcassets/navigationBarBg.imageset/navigationBarBg@2x.png -------------------------------------------------------------------------------- /RRStock/RRStock/Assets.xcassets/compose_photo_close.imageset/compose_photo_close@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qingluanchou/RRStock/HEAD/RRStock/RRStock/Assets.xcassets/compose_photo_close.imageset/compose_photo_close@2x.png -------------------------------------------------------------------------------- /RRStock/RRStock.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Tools/UIButton+CZ/CustomButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // CustomButton.h 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 16/6/7. 6 | // Copyright © 2016年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CustomButton : UIButton 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Model/KLineModel/JMSKLineModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // JMSKLineModel.m 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/5/7. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import "JMSKLineModel.h" 10 | 11 | @implementation JMSKLineModel 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/StockDetailTopView.h: -------------------------------------------------------------------------------- 1 | // 2 | // StockDetailTopView.h 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 16/8/22. 6 | // Copyright © 2016年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface StockDetailTopView : UIView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/StockDetailBottomView.h: -------------------------------------------------------------------------------- 1 | // 2 | // StockDetailBottomView.h 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 16/8/22. 6 | // Copyright © 2016年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface StockDetailBottomView : UIView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Model/TimeLineModel/JMSTimeLineModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // JMSTimeLineModel.m 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/5/8. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import "JMSTimeLineModel.h" 10 | 11 | @implementation JMSTimeLineModel 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/TimeLine/FiveRangeCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // FiveRangeCell.h 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 16/8/23. 6 | // Copyright © 2016年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FiveRangeCell : UITableViewCell 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/TimeLine/TradeDetailCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // TradeDetailCell.h 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 16/8/23. 6 | // Copyright © 2016年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TradeDetailCell : UITableViewCell 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Controller/StockNewsController.h: -------------------------------------------------------------------------------- 1 | // 2 | // StockNewsController.h 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 16/8/23. 6 | // Copyright © 2016年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface StockNewsController : UITableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Controller/StockTradeController.h: -------------------------------------------------------------------------------- 1 | // 2 | // StockTradeController.h 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 16/8/23. 6 | // Copyright © 2016年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface StockTradeController : UITableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /RRStock/RRStock/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 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Controller/StockNoticeController.h: -------------------------------------------------------------------------------- 1 | // 2 | // StockNoticeController.h 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 16/8/23. 6 | // Copyright © 2016年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface StockNoticeController : UITableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/IgnoreHeaderTouchTableView.h: -------------------------------------------------------------------------------- 1 | // 2 | // IgnoreHeaderTouchTableView.h 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 16/4/21. 6 | // Copyright © 2016年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface IgnoreHeaderTouchTableView : UITableView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Controller/StockDataController.h: -------------------------------------------------------------------------------- 1 | // 2 | // StockDataController.h 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 16/8/23. 6 | // Copyright © 2016年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //资料 12 | @interface StockDataController : UITableViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Model/TimeLineModel/JMSGroupTimeLineModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // JMSGroupTimeLineModel.m 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/6/6. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import "JMSGroupTimeLineModel.h" 10 | 11 | @implementation JMSGroupTimeLineModel 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/TimeLine/TradeDetailTableView.h: -------------------------------------------------------------------------------- 1 | // 2 | // TradeDetailTableView.h 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 16/8/23. 6 | // Copyright © 2016年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TradeDetailTableView : UITableView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Model/MJExtension/NSString+MJExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+MJExtension.h 3 | // TestTabBar 4 | // 5 | // Created by MJ Lee on 15/4/17. 6 | // Copyright (c) 2015年 Mac Z. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSString (MJExtension) 12 | - (id)JSONObject; 13 | @end 14 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/TimeLine/FiveRangeTableView.h: -------------------------------------------------------------------------------- 1 | // 2 | // FiveRangeTableView.h 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 16/8/23. 6 | // Copyright © 2016年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FiveRangeTableView : UITableView 12 | 13 | 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Controller/StockOpinionController.h: -------------------------------------------------------------------------------- 1 | // 2 | // StockOpinionController.h 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 16/8/23. 6 | // Copyright © 2016年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //股票观点 12 | @interface StockOpinionController : UITableViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/KLine/AboveView/HYKLineAboveAxisMaskView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYKLineAboveAxisMaskView.h 3 | // RRStock 4 | // 5 | // Created by 曾文亮 on 16/12/17. 6 | // Copyright © 2016年 liang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HYKLineAboveAxisMaskView : UIView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Controller/StockInfoDetailViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // StockInfoDetailViewController.h 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 16/8/23. 6 | // Copyright © 2016年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface StockInfoDetailViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Model/MJExtension/MJFoundation.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJFoundation.h 3 | // MJExtensionExample 4 | // 5 | // Created by MJ Lee on 14/7/16. 6 | // Copyright (c) 2014年 itcast. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MJFoundation : NSObject 12 | + (BOOL)isClassFromFoundation:(Class)c; 13 | @end 14 | -------------------------------------------------------------------------------- /RRStock/RRStock/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // RRStock 4 | // 5 | // Created by 曾文亮 on 16/11/24. 6 | // Copyright © 2016年 liang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Controller/StockResearchReportController.h: -------------------------------------------------------------------------------- 1 | // 2 | // StockResearchReportController.h 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 16/8/23. 6 | // Copyright © 2016年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //研报 12 | @interface StockResearchReportController : UITableViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/RecognizeSimultaneousTableView.h: -------------------------------------------------------------------------------- 1 | // 2 | // RecognizeSimultaneousTableView.h 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 16/4/21. 6 | // Copyright © 2016年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import "IgnoreHeaderTouchTableView.h" 10 | 11 | @interface RecognizeSimultaneousTableView : IgnoreHeaderTouchTableView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/HYStockChartTool/HYStockChartTool.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYStockChartTool.h 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/6/14. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HYStockChartTool : NSObject 12 | 13 | +(NSString *)currencySymbol; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/StockChartView/StockChartProfileModel/HYStockChartProfileModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // HYStockChartProfileModel.m 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/6/6. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import "HYStockChartProfileModel.h" 10 | 11 | @implementation HYStockChartProfileModel 12 | 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/TimeLine/AboveView/HYTimeLineAbovePositionModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // HYTimeLineAbovePositionModel.m 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/8. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import "HYTimeLineAbovePositionModel.h" 10 | 11 | @implementation HYTimeLineAbovePositionModel 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/TimeLine/BelowView/HYTimeLineBelowPositionModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // HYTimeLineBelowPositionModel.m 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/8. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import "HYTimeLineBelowPositionModel.h" 10 | 11 | @implementation HYTimeLineBelowPositionModel 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/StockContentView.h: -------------------------------------------------------------------------------- 1 | // 2 | // StockContentView.h 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 16/8/23. 6 | // Copyright © 2016年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface StockContentView : UIView 12 | 13 | 14 | 15 | -(instancetype)initWithTabConfigArray:(NSArray *)tabConfigArray;//tab页配置数组 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Controller/HYStockChartViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYStockChartViewController.h 3 | // HYStockChartDemo 4 | // 5 | // Created by jimubox on 15/6/24. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HYStockChartViewController : UIViewController 12 | 13 | @property(nonatomic,assign) BOOL isFullScreen; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Tools/UILabel+CZ/CustomLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // CustomLabel.h 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 15/11/20. 6 | // Copyright © 2015年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CustomLabel : UILabel 12 | 13 | + (CustomLabel *)setCustomLabelText:(NSString *)text font:(CGFloat)font textColor:(UIColor *)textColor; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /RRStock/RRStock/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // RRStock 4 | // 5 | // Created by 曾文亮 on 16/11/24. 6 | // Copyright © 2016年 liang. 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 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/StockDetailHeaderView.h: -------------------------------------------------------------------------------- 1 | // 2 | // StockDetailHeaderView.h 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 16/8/22. 6 | // Copyright © 2016年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef void(^StockDetailHeaderBlock)(); 12 | @interface StockDetailHeaderView : UIView 13 | 14 | @property (nonatomic,copy)StockDetailHeaderBlock headerBlock; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /RRStock/RRStock/DetailViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DetailViewController.h 3 | // RRStock 4 | // 5 | // Created by 曾文亮 on 16/11/24. 6 | // Copyright © 2016年 liang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DetailViewController : UIViewController 12 | 13 | @property (strong, nonatomic) id detailItem; 14 | @property (weak, nonatomic) IBOutlet UILabel *detailDescriptionLabel; 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /RRStock/RRStock/MasterViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MasterViewController.h 3 | // RRStock 4 | // 5 | // Created by 曾文亮 on 16/11/24. 6 | // Copyright © 2016年 liang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class DetailViewController; 12 | 13 | @interface MasterViewController : UITableViewController 14 | 15 | @property (strong, nonatomic) DetailViewController *detailViewController; 16 | 17 | 18 | @end 19 | 20 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/TimeLine/UIView+HXCircleAnimation.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+HXCircleAnimation.h 3 | // HXCircleAnimation 4 | // 5 | // Created by TheLittleBoy on 16/3/21. 6 | // Copyright © 2016年 华夏大地教育. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIView (HXCircleAnimation) 12 | 13 | -(void)showCircleAnimationLayerWithColor:(UIColor *)circleColor andScale:(CGFloat)scale; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /RRStock/RRStock/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 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Controller/ArtTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ArtTableViewController.h 3 | // Demo 4 | // 5 | // Created by weijingyun on 16/5/28. 6 | // Copyright © 2016年 weijingyun. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ArtTableViewController : UIViewController 12 | 13 | @property (nonatomic, strong, readonly) UITableView *tableView; 14 | @property (nonatomic, assign) NSInteger index; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /RRStock/RRStock/Assets.xcassets/navigationBarBg.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "navigationBarBg@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /RRStock/RRStock/Assets.xcassets/compose_photo_close.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "compose_photo_close@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/Category/NSDateFormatter+HYStockChart/NSDateFormatter+HYStockChart.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDateFormatter+HYStockChart.h 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/6/14. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSDateFormatter (HYStockChart) 12 | 13 | /** 14 | * 创建单例NSDateFormatter 15 | */ 16 | +(NSDateFormatter *)shareDateFormatter; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/KLine/KLineDetailView/HYKLineDetailView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYKLineDetailView.h 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/5/25. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | @class HYKLineModel; 11 | /************************某根K线的详细信息的View************************/ 12 | @interface HYKLineDetailView : UIView 13 | 14 | @property(nonatomic,strong) HYKLineModel *kLineModel; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Model/KLineModel/JMSKLineGroupModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // JMSKLineGroupModel.m 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/5/7. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import "JMSKLineGroupModel.h" 10 | #import "JMSKLineModel.h" 11 | #import "MJExtension.h" 12 | 13 | @implementation JMSKLineGroupModel 14 | 15 | +(NSDictionary *)objectClassInArray 16 | { 17 | return @{@"GlobalQuotes":@"JMSKLineModel"}; 18 | } 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Model/MJExtension/NSString+MJExtension.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+MJExtension.m 3 | // TestTabBar 4 | // 5 | // Created by MJ Lee on 15/4/17. 6 | // Copyright (c) 2015年 Mac Z. All rights reserved. 7 | // 8 | 9 | #import "NSString+MJExtension.h" 10 | 11 | @implementation NSString (MJExtension) 12 | - (id)JSONObject 13 | { 14 | return [NSJSONSerialization JSONObjectWithData:[self dataUsingEncoding:NSUTF8StringEncoding] options:kNilOptions error:nil]; 15 | } 16 | @end 17 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Model/MJExtension/MJExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJExtension.h 3 | // MJExtension 4 | // 5 | // Created by mj on 14-1-15. 6 | // Copyright (c) 2014年 itcast. All rights reserved. 7 | // 代码地址:https://github.com/CoderMJLee/MJExtension 8 | // 代码地址:http://code4app.com/ios/%E5%AD%97%E5%85%B8-JSON-%E4%B8%8E%E6%A8%A1%E5%9E%8B%E7%9A%84%E8%BD%AC%E6%8D%A2/5339992a933bf062608b4c57 9 | 10 | #import "NSObject+MJCoding.h" 11 | #import "NSObject+MJProperty.h" 12 | #import "NSObject+MJKeyValue.h" 13 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/TimeLine/AboveView/HYTimeLineAbovePositionModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYTimeLineAbovePositionModel.h 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/8. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /************************分时线上面的view的位置模型************************/ 12 | @interface HYTimeLineAbovePositionModel : NSObject 13 | 14 | @property(nonatomic,assign) CGPoint currentPoint; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RRStock 2 | 整合了分时图,日周月K线图,五档图,长按,捏合缩放,全屏非全屏切换自适应,行情,资料等控制视图,项目还没完善,后续会更新哦,😁 3 | 4 | ## 竖屏样式展示,分时图,K线图,观点,公告 5 | ![Mou icon](https://github.com/qingluanchou/RRStock/blob/master/RRStock/RRStock/test6.gif?raw=true) 6 | 7 | ## 分时图,5档图,K线图横屏展示效果 8 | ![Mou icon](https://github.com/qingluanchou/RRStock/blob/master/RRStock/RRStock/test8.gif?raw=true) 9 | 10 | ##### 项目是参照**HYStockChart**demo https://github.com/NunchakusHuang/HYStockChart.git 改的,还没有完善,只做了一部分,代码也比较乱,后续有时间会进一步完善,有需要的小伙伴,可以先用用,喜欢的话,给个小星星哟☺️ 11 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/KLine/KLineDetailView/HYKLineDetailView.m: -------------------------------------------------------------------------------- 1 | // 2 | // HYKLineDetailView.m 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/5/25. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import "HYKLineDetailView.h" 10 | 11 | @interface HYKLineDetailView () 12 | 13 | @end 14 | 15 | @implementation HYKLineDetailView 16 | 17 | -(void)setKLineModel:(HYKLineModel *)kLineModel 18 | { 19 | _kLineModel = kLineModel; 20 | 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Model/KLineModel/JMSKLineGroupModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // JMSKLineGroupModel.h 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/5/7. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface JMSKLineGroupModel : NSObject 12 | 13 | @property(nonatomic,copy) NSString *StartDate; 14 | 15 | @property(nonatomic,copy) NSString *EndDate; 16 | 17 | /** 18 | * K线的数组 19 | */ 20 | @property(nonatomic,strong) NSArray *GlobalQuotes; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/HYStockChart.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYStockChart.h 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/4. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #ifndef JimuStockChartDemo_HYStockChart_h 10 | #define JimuStockChartDemo_HYStockChart_h 11 | 12 | #import "HYStockChartView.h" 13 | #import "HYKLineView.h" 14 | #import "HYTimeLineView.h" 15 | #import "HYKLineModel.h" 16 | #import "HYStockChartProfileModel.h" 17 | #import "HYStockChartConstant.h" 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/StockChartView/StockProfileView/TimeLineLongPressProfileView/HYTimeLineLongPressView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYTimeLineLongPressView.h 3 | // RRStock 4 | // 5 | // Created by 曾文亮 on 16/12/17. 6 | // Copyright © 2016年 liang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class HYTimeLineModel; 12 | @interface HYTimeLineLongPressView : UIView 13 | 14 | +(instancetype)timeLineLongPressProfileView; 15 | 16 | @property(nonatomic,strong) HYTimeLineModel *timeLineModel; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/StockChartView/StockProfileView/BrokenLineLongPressProfileView/HYBrokenLineLongPressView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYTimeLineLongPressView.h 3 | // RRStock 4 | // 5 | // Created by 曾文亮 on 16/12/17. 6 | // Copyright © 2016年 liang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class HYTimeLineModel; 12 | @interface HYBrokenLineLongPressView : UIView 13 | 14 | +(instancetype)brokenLineLongPressProfileView; 15 | 16 | @property(nonatomic,strong) HYTimeLineModel *timeLineModel; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/StockDetailBottomView.m: -------------------------------------------------------------------------------- 1 | // 2 | // StockDetailBottomView.m 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 16/8/22. 6 | // Copyright © 2016年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import "StockDetailBottomView.h" 10 | 11 | @implementation StockDetailBottomView 12 | 13 | /* 14 | // Only override drawRect: if you perform custom drawing. 15 | // An empty implementation adversely affects performance during animation. 16 | - (void)drawRect:(CGRect)rect { 17 | // Drawing code 18 | } 19 | */ 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Model/TimeLineModel/JMSGroupTimeLineModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // JMSGroupTimeLineModel.h 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/6/6. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface JMSGroupTimeLineModel : NSObject 12 | 13 | /** 14 | * 服务器的数据是PreviousClose 15 | */ 16 | @property(nonatomic,assign) CGFloat lastDayEndPrice; 17 | 18 | /** 19 | * 里面装的是JMSTimeLineModel 20 | */ 21 | @property(nonatomic,strong) NSArray *timeLineModels; 22 | 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/TimeLine/BelowView/HYTimeLineBelowPositionModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYTimeLineBelowPositionModel.h 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/8. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /************************分时线下面的view的位置模型************************/ 12 | @interface HYTimeLineBelowPositionModel : NSObject 13 | 14 | @property(nonatomic,assign) CGPoint startPoint; 15 | 16 | @property(nonatomic,assign) CGPoint endPoint; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/KLine/AboveView/HYKLineAboveAxisMaskView.m: -------------------------------------------------------------------------------- 1 | // 2 | // HYKLineAboveAxisMaskView.m 3 | // RRStock 4 | // 5 | // Created by 曾文亮 on 16/12/17. 6 | // Copyright © 2016年 liang. All rights reserved. 7 | // 8 | 9 | #import "HYKLineAboveAxisMaskView.h" 10 | 11 | @implementation HYKLineAboveAxisMaskView 12 | 13 | /* 14 | // Only override drawRect: if you perform custom drawing. 15 | // An empty implementation adversely affects performance during animation. 16 | - (void)drawRect:(CGRect)rect { 17 | // Drawing code 18 | } 19 | */ 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/StockChartView/StockProfileView/KLineLongPressProfileView/HYKLineLongPressView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYKLineLongPressView.h 3 | // RRStock 4 | // 5 | // Created by 曾文亮 on 16/12/17. 6 | // Copyright © 2016年 liang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class HYKLineModel; 12 | @interface HYKLineLongPressView : UIView 13 | 14 | @property(nonatomic,strong) HYKLineModel *kLineModel; 15 | 16 | /** 17 | * 工厂方法加载一个HYKLineLongPressProfileViewxib 18 | */ 19 | +(instancetype)kLineLongPressProfileView; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Tools/UIButton+CZ/UIButton+CZ.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIButton+CZ.h 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 15/11/23. 6 | // Copyright © 2015年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIButton (CZ) 12 | 13 | + (UIButton *)setCustomButton:(NSString *)title backGroundColor:(UIColor *)backGroundColor backGroundImage:(UIImage *)image textColor:(UIColor *)textColor textFont:(CGFloat)font; 14 | 15 | + (UIButton *)setIcon:(UIImage *)image setSelectedIcon:(UIImage *)selectedImage sethighLightIcon:(UIImage *)highLightImage; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/StockChartYView/HYStockChartYView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYStockChartPriceView.h 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/5/25. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /************************Y轴的View************************/ 12 | @interface HYStockChartYView : UIView 13 | 14 | @property(nonatomic,assign) CGFloat maxValue; 15 | 16 | @property(nonatomic,assign) CGFloat middleValue; 17 | 18 | @property(nonatomic,assign) CGFloat minValue; 19 | 20 | @property(nonatomic,copy) NSString *minLabelText; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/StockChartView/StockProfileView/DefaultProfileView/HYStoctDefaultProfileView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYStockChartProfileView.h 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/14. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class HYStockChartProfileModel; 12 | /************************股票概要View(在顶部的view)************************/ 13 | @interface HYStoctDefaultProfileView : UIView 14 | 15 | @property(nonatomic,strong) HYStockChartProfileModel *profileModel; 16 | 17 | +(HYStoctDefaultProfileView *)profileView; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/StockChartView/StockProfileView/TimeLineLongPressProfileView/HYTimeLineLongPressProfileView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYTimeLineLongPressProfileView.h 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/6/8. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class HYTimeLineModel; 12 | /************************分时线长按的简介view************************/ 13 | @interface HYTimeLineLongPressProfileView : UIView 14 | 15 | +(instancetype)timeLineLongPressProfileView; 16 | 17 | @property(nonatomic,strong) HYTimeLineModel *timeLineModel; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /RRStock/RRStock/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 | -------------------------------------------------------------------------------- /RRStock/RRStock/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 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/StockChartView/StockProfileView/KLineLongPressProfileView/HYKLineLongPressProfileView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYKLineLongPressProfileView.h 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/6/8. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class HYKLineModel; 12 | /************************K线长按的简介view************************/ 13 | @interface HYKLineLongPressProfileView : UIView 14 | 15 | @property(nonatomic,strong) HYKLineModel *kLineModel; 16 | 17 | /** 18 | * 工厂方法加载一个HYKLineLongPressProfileViewxib 19 | */ 20 | +(instancetype)kLineLongPressProfileView; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/TimeLine/BelowView/YYTimeLineBelowMaskView.h: -------------------------------------------------------------------------------- 1 | // 2 | // YYTimeLineBelowMaskView.h 3 | // RRStock 4 | // 5 | // Created by 曾文亮 on 16/12/17. 6 | // Copyright © 2016年 liang. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HYTimeLineModel.h" 11 | #import "HYTimeLineAboveView.h" 12 | 13 | @interface YYTimeLineBelowMaskView : UIView 14 | 15 | //当前长按选中的model 16 | @property (nonatomic, strong) HYTimeLineModel *selectedModel; 17 | 18 | //当前长按选中的位置model 19 | @property (nonatomic, assign) CGPoint selectedPoint; 20 | 21 | //当前的滑动scrollview 22 | @property (nonatomic, strong) HYTimeLineAboveView *timeLineView; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/TimeLine/TimeLineModel/HYTimeLineGroupModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYTimeLineGroupModel.h 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/11. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HYTimeLineModel.h" 11 | 12 | @interface HYTimeLineGroupModel : NSObject 13 | 14 | /** 15 | * 这个数组装得是HYTimeLineModel 16 | */ 17 | @property(nonatomic,strong) NSArray *timeModels; 18 | 19 | @property(nonatomic,assign) CGFloat lastDayEndPrice; 20 | 21 | +(instancetype)groupModelWithTimeModels:(NSArray *)timeModels lastDayEndPrice:(CGFloat)lastDayEndPrice; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/StockChartView/StockProfileView/BrokenLineLongPressProfileView/HYBrokenLineLongPressProfileView.h: -------------------------------------------------------------------------------- 1 | // 2 | // JMBBrokenLineLongPressProfileView.h 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/6/9. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class HYTimeLineModel; 12 | /************************折线长按的profileView************************/ 13 | @interface HYBrokenLineLongPressProfileView : UIView 14 | 15 | @property(nonatomic,strong) HYTimeLineModel *timeLineModel; 16 | 17 | /** 18 | * 工厂方法创建一个折线的详情view 19 | */ 20 | +(instancetype)brokenLineLongPressProfileView; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/TimeLine/TimeLineModel/HYTimeLineModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYTimeLineModel.h 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/8. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HYTimeLineModel : NSObject 12 | 13 | @property(nonatomic,assign) CGFloat currentPrice; 14 | 15 | @property(nonatomic,copy) NSString *currentTime; 16 | 17 | @property(nonatomic,copy) NSString *currentDate; 18 | 19 | @property(nonatomic,assign) NSInteger volume; 20 | 21 | @property(nonatomic,assign) CGFloat ChangeFromPreClose; 22 | 23 | @property(nonatomic,assign) CGFloat PercentChangeFromPreClose; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/StockChartTitleView.h: -------------------------------------------------------------------------------- 1 | // 2 | // StockChartTitleView.h 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 16/8/22. 6 | // Copyright © 2016年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | * 定义点击的block 13 | * 14 | * @param NSInteger 点击column数 15 | */ 16 | typedef void (^StockTabChartTitleClickBlock)(NSInteger); 17 | 18 | @interface StockChartTitleView : UIView 19 | 20 | -(instancetype)initWithTitleArray:(NSArray *)titleArray; 21 | 22 | -(void)setItemSelected: (NSInteger)column; 23 | 24 | 25 | - (void)setScrollDistance:(CGFloat )ratio; 26 | 27 | @property (nonatomic, copy) StockTabChartTitleClickBlock titleClickBlock; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/TimeLine/TimeLineModel/HYTimeLineGroupModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // HYTimeLineGroupModel.m 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/11. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import "HYTimeLineGroupModel.h" 10 | #import "MJExtension.h" 11 | 12 | @implementation HYTimeLineGroupModel 13 | 14 | +(instancetype)groupModelWithTimeModels:(NSArray *)timeModels lastDayEndPrice:(CGFloat)lastDayEndPrice 15 | { 16 | HYTimeLineGroupModel *groupModel = [[HYTimeLineGroupModel alloc] init]; 17 | groupModel.timeModels = timeModels; 18 | groupModel.lastDayEndPrice = lastDayEndPrice; 19 | return groupModel; 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/KLine/BelowView/HYKLineVolumePositionModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYKLineVolumePositionModel.h 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/8. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | /************************成交量位置模型************************/ 13 | @interface HYKLineVolumePositionModel : NSObject 14 | 15 | @property(nonatomic,assign) CGPoint startPoint; 16 | 17 | @property(nonatomic,assign) CGPoint endPoint; 18 | 19 | /** 20 | * 根据x、y创建一个模型 21 | */ 22 | +(instancetype)volumePositionModelWithStartPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/KLine/HYKLineView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYKLineView.h 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/4. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | /************************展示K线图和数据更新的View************************/ 13 | @interface HYKLineView : UIView 14 | 15 | @property(nonatomic,strong) NSArray *kLineModels; 16 | 17 | /** 18 | * 上面那个view所占的比例 19 | */ 20 | @property(nonatomic,assign) CGFloat aboveViewRatio; 21 | 22 | /** 23 | * 重绘 24 | */ 25 | -(void)reDraw; 26 | 27 | /** 28 | * 根据指定颜色清除背景 29 | */ 30 | -(void)clearRectWithColor:(UIColor *)bgColor NS_DEPRECATED_IOS(2_0,2_0,"这个方法暂时没有实现!"); 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/TimeLine/AboveView/YYTimeLineMaskView.h: -------------------------------------------------------------------------------- 1 | // 2 | // YYTimeLineMaskView.h 3 | // YYStock ( https://github.com/yate1996 ) 4 | // 5 | // Created by yate1996 on 16/10/10. 6 | // Copyright © 2016年 yate1996. All rights reserved. 7 | // 8 | 9 | #import 10 | //#import "YYStockTimeLineProtocol.h" 11 | #import "HYTimeLineModel.h" 12 | #import "HYTimeLineAboveView.h" 13 | 14 | @interface YYTimeLineMaskView : UIView 15 | 16 | //当前长按选中的model 17 | @property (nonatomic, strong) HYTimeLineModel *selectedModel; 18 | 19 | //当前长按选中的位置model 20 | @property (nonatomic, assign) CGPoint selectedPoint; 21 | 22 | //当前的滑动scrollview 23 | @property (nonatomic, strong) UIView *timeLineView; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/TimeLine/BelowView/HYTimeLineVolume.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYTimeLineVolume.h 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/11. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /************************分时线上成交量的画笔************************/ 12 | @interface HYTimeLineVolume : NSObject 13 | 14 | @property(nonatomic,strong) NSArray *timeLineVolumnPositionModels; 15 | 16 | //当前视图的宽度 17 | @property (nonatomic,assign)CGFloat currentXWidth; 18 | 19 | 20 | 21 | //显示颜色数组 22 | @property(nonatomic,strong) NSArray *colorArray; 23 | 24 | -(instancetype)initWithContext:(CGContextRef)context; 25 | 26 | 27 | -(void)draw; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Tools/UIView+Extension/UIView+Extension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+Extension.h 3 | // RRCP 4 | // 5 | // Created by zwl on 15/11/2. 6 | // Copyright © 2015年 qinxin. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIView (Extension) 12 | 13 | /** 14 | * 在分类中使用@property只会生成get/set方法的声明,不会实现 15 | */ 16 | 17 | @property (nonatomic, assign) CGFloat centerX; 18 | 19 | @property (nonatomic, assign) CGFloat centerY; 20 | 21 | @property (nonatomic, assign) CGFloat x; 22 | 23 | @property (nonatomic, assign) CGFloat y; 24 | 25 | @property (nonatomic, assign) CGFloat width; 26 | 27 | @property (nonatomic, assign) CGFloat height; 28 | 29 | @property (nonatomic, assign) CGSize size; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/KLine/BelowView/HYKLineVolumePositionModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // HYKLineVolumePositionModel.m 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/8. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import "HYKLineVolumePositionModel.h" 10 | 11 | @implementation HYKLineVolumePositionModel 12 | 13 | /** 14 | * 根据x、y创建一个模型 15 | */ 16 | +(instancetype)volumePositionModelWithStartPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint 17 | { 18 | HYKLineVolumePositionModel *volumePosition = [HYKLineVolumePositionModel new]; 19 | volumePosition.startPoint = startPoint; 20 | volumePosition.endPoint = endPoint; 21 | return volumePosition; 22 | } 23 | 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/KLine/AboveView/HYMALine.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYMALine.h 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/5/28. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef NS_ENUM(NSInteger, HYMAType){ 12 | HYMA5Type = 0, 13 | HYMA10Type, 14 | HYMA20Type, 15 | HYMA30Type 16 | }; 17 | 18 | /************************画均线的画笔************************/ 19 | @interface HYMALine : NSObject 20 | 21 | @property(nonatomic,strong) NSArray *MAPositions; 22 | 23 | @property(nonatomic,assign) HYMAType MAType; 24 | 25 | /** 26 | * 根据context初始化均线画笔 27 | */ 28 | -(instancetype)initWitContext:(CGContextRef)context; 29 | 30 | -(void)draw; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Tools/UIButton+CZ/CustomButton.m: -------------------------------------------------------------------------------- 1 | // 2 | // CustomButton.m 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 16/6/7. 6 | // Copyright © 2016年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import "CustomButton.h" 10 | 11 | @implementation CustomButton 12 | 13 | /* 14 | // Only override drawRect: if you perform custom drawing. 15 | // An empty implementation adversely affects performance during animation. 16 | - (void)drawRect:(CGRect)rect { 17 | // Drawing code 18 | } 19 | */ 20 | 21 | - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event 22 | { 23 | if (CGRectContainsPoint(self.frame, point)) 24 | { 25 | return NO; 26 | } 27 | return [super pointInside:point withEvent:event]; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/KLine/AboveView/HYKLinePositionModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // HYKLinePositionModel.m 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/4. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import "HYKLinePositionModel.h" 10 | 11 | @implementation HYKLinePositionModel 12 | 13 | #pragma mark 用属性创建一个模型 14 | +(instancetype)modelWithOpen:(CGPoint)openPoint close:(CGPoint)closePoint high:(CGPoint)highPoint low:(CGPoint)lowPoint 15 | { 16 | HYKLinePositionModel *model = [HYKLinePositionModel new]; 17 | model.openPoint = openPoint; 18 | model.closePoint = closePoint; 19 | model.highPoint = highPoint; 20 | model.lowPoint = lowPoint; 21 | return model; 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Model/MJExtension/MJConst.m: -------------------------------------------------------------------------------- 1 | #ifndef __MJConst__M__ 2 | #define __MJConst__M__ 3 | 4 | #import 5 | 6 | /** 7 | * 成员变量类型(属性类型) 8 | */ 9 | NSString *const MJTypeInt = @"i"; 10 | NSString *const MJTypeFloat = @"f"; 11 | NSString *const MJTypeDouble = @"d"; 12 | NSString *const MJTypeLong = @"q"; 13 | NSString *const MJTypeLongLong = @"q"; 14 | NSString *const MJTypeChar = @"c"; 15 | NSString *const MJTypeBOOL = @"c"; 16 | NSString *const MJTypePointer = @"*"; 17 | 18 | NSString *const MJTypeIvar = @"^{objc_ivar=}"; 19 | NSString *const MJTypeMethod = @"^{objc_method=}"; 20 | NSString *const MJTypeBlock = @"@?"; 21 | NSString *const MJTypeClass = @"#"; 22 | NSString *const MJTypeSEL = @":"; 23 | NSString *const MJTypeId = @"@"; 24 | 25 | #endif -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/HYStockChartTool/HYStockChartTool.m: -------------------------------------------------------------------------------- 1 | // 2 | // HYStockChartTool.m 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/6/14. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import "HYStockChartTool.h" 10 | #import "HYStockChartGloablVariable.h" 11 | 12 | @implementation HYStockChartTool 13 | 14 | +(NSString *)currencySymbol 15 | { 16 | HYStockType stockType = [HYStockChartGloablVariable stockType]; 17 | switch (stockType) { 18 | case HYStockTypeUSA: 19 | return @"$"; 20 | break; 21 | case HYStockTypeHK: 22 | return @"HKD"; 23 | break; 24 | default: 25 | return @"¥"; 26 | break; 27 | } 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/TimeLine/TimeLineModel/HYTimeLineModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // HYTimeLineModel.m 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/8. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import "HYTimeLineModel.h" 10 | #import "MJExtension.h" 11 | 12 | @implementation HYTimeLineModel 13 | 14 | +(NSDictionary *)replacedKeyFromPropertyName 15 | { 16 | return @{@"currentPrice":@"Close", 17 | @"currentTime":@"EndTime", 18 | @"currentDate":@"EndDate", 19 | @"volume":@"Volume" 20 | }; 21 | } 22 | 23 | -(NSString *)currentTime 24 | { 25 | NSString *fullTime = [NSString stringWithFormat:@"%@ %@",_currentDate,_currentTime]; 26 | return fullTime; 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/RecognizeSimultaneousTableView.m: -------------------------------------------------------------------------------- 1 | // 2 | // RecognizeSimultaneousTableView.m 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 16/4/21. 6 | // Copyright © 2016年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import "RecognizeSimultaneousTableView.h" 10 | 11 | @implementation RecognizeSimultaneousTableView 12 | 13 | /* 14 | // Only override drawRect: if you perform custom drawing. 15 | // An empty implementation adversely affects performance during animation. 16 | - (void)drawRect:(CGRect)rect { 17 | // Drawing code 18 | } 19 | */ 20 | 21 | - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { 22 | return YES; 23 | } 24 | 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/TimeLine/AboveView/HYTimeLine.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYTimeLine.h 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/8. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HYTimeLineAbovePositionModel.h" 11 | 12 | /************************用于画分时线的画笔************************/ 13 | @interface HYTimeLine : NSObject 14 | 15 | /**曲线点位置数据数组*/ 16 | @property(nonatomic,strong) NSArray *positionModels; 17 | 18 | /** 昨天收盘价位置*/ 19 | @property(nonatomic,assign) CGFloat horizontalYPosition; 20 | 21 | @property(nonatomic,assign) CGFloat timeLineViewWidth; 22 | 23 | @property(nonatomic,assign) CGFloat timeLineViewMaxY; 24 | 25 | -(instancetype)initWithContext:(CGContextRef)context; 26 | 27 | -(void)draw; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/Category/NSDateFormatter+HYStockChart/NSDateFormatter+HYStockChart.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSDateFormatter+HYStockChart.m 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/6/14. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import "NSDateFormatter+HYStockChart.h" 10 | 11 | @implementation NSDateFormatter (HYStockChart) 12 | 13 | +(NSDateFormatter *)shareDateFormatter 14 | { 15 | static NSDateFormatter *formatter = nil; 16 | static dispatch_once_t onceToken; 17 | dispatch_once(&onceToken, ^{ 18 | formatter = [NSDateFormatter new]; 19 | formatter.locale = [NSLocale localeWithLocaleIdentifier:@"en_US"]; 20 | formatter.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:8]; 21 | }); 22 | return formatter; 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/StockChartView/StockChartProfileModel/HYStockChartProfileModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYStockChartProfileModel.h 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/6/6. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HYStockChartGloablVariable.h" 11 | 12 | @interface HYStockChartProfileModel : NSObject 13 | 14 | @property(nonatomic,copy) NSString *Name; 15 | 16 | @property(nonatomic,copy) NSString *ChineseName; 17 | 18 | @property(nonatomic,copy) NSString *Symbol; 19 | 20 | @property(nonatomic,assign) CGFloat CurrentPrice; 21 | 22 | @property(nonatomic,assign) CGFloat Volume; 23 | 24 | @property(nonatomic,assign) HYStockType stockType; 25 | 26 | /** 27 | * 涨跌幅 28 | */ 29 | @property(nonatomic,assign) CGFloat applies; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/IgnoreHeaderTouchTableView.m: -------------------------------------------------------------------------------- 1 | // 2 | // IgnoreHeaderTouchTableView.m 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 16/4/21. 6 | // Copyright © 2016年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import "IgnoreHeaderTouchTableView.h" 10 | 11 | @implementation IgnoreHeaderTouchTableView 12 | 13 | /* 14 | // Only override drawRect: if you perform custom drawing. 15 | // An empty implementation adversely affects performance during animation. 16 | - (void)drawRect:(CGRect)rect { 17 | // Drawing code 18 | } 19 | */ 20 | 21 | //- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event 22 | //{ 23 | // if (self.tableHeaderView && CGRectContainsPoint(self.tableHeaderView.frame, point)) { 24 | // return NO; 25 | // } 26 | // return [super pointInside:point withEvent:event]; 27 | //} 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /RRStock/RRStockTests/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /RRStock/RRStockUITests/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/KLine/BelowView/HYKLineVolume.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYKLineVolume.h 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/8. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HYKLineVolumePositionModel.h" 11 | #import "HYKLineModel.h" 12 | 13 | /************************画成交量线的画笔************************/ 14 | @interface HYKLineVolume : NSObject 15 | 16 | /** 17 | * 位置模型 18 | */ 19 | @property(nonatomic,strong) HYKLineVolumePositionModel *positionModel; 20 | 21 | /** 22 | * K线模型,里面包含成交量 23 | */ 24 | @property(nonatomic,strong) HYKLineModel *kLineModel; 25 | 26 | @property(nonatomic,strong) UIColor *lineColor; 27 | 28 | 29 | -(instancetype)initWithContext:(CGContextRef)context; 30 | 31 | /** 32 | * 绘制成交量 33 | */ 34 | -(void)draw; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/TimeLine/HYTimeLineView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYTimeLineView.h 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/8. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HYTimeLineGroupModel.h" 11 | #import "HYStockChartConstant.h" 12 | 13 | @interface HYTimeLineView : UIView 14 | 15 | @property(nonatomic,strong) HYTimeLineGroupModel *timeLineGroupModel; 16 | 17 | @property(nonatomic,assign) CGFloat aboveViewRatio; 18 | 19 | @property(nonatomic,assign) BOOL isNeedDrawTime; 20 | 21 | @property(nonatomic,assign) HYStockChartCenterViewType centerViewType; 22 | 23 | /** 24 | * 重绘 25 | */ 26 | -(void)reDraw; 27 | 28 | /** 29 | * 根据指定颜色清除背景 30 | */ 31 | -(void)clearRectWithColor:(UIColor *)bgColor NS_DEPRECATED_IOS(2_0,2_0,"这个方法暂时没有实现!"); 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Tools/UILabel+CZ/CustomLabel.m: -------------------------------------------------------------------------------- 1 | // 2 | // CustomLabel.m 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 15/11/20. 6 | // Copyright © 2015年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import "CustomLabel.h" 10 | 11 | @implementation CustomLabel 12 | 13 | + (CustomLabel *)setCustomLabelText:(NSString *)text font:(CGFloat)font textColor:(UIColor *)textColor { 14 | 15 | CustomLabel *customLabel = [[self alloc] init]; 16 | customLabel.text = text; 17 | customLabel.font = [UIFont systemFontOfSize:font]; 18 | customLabel.textColor = textColor; 19 | 20 | return customLabel; 21 | } 22 | 23 | /* 24 | // Only override drawRect: if you perform custom drawing. 25 | // An empty implementation adversely affects performance during animation. 26 | - (void)drawRect:(CGRect)rect { 27 | // Drawing code 28 | } 29 | */ 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/KLine/AboveView/HYKLine.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYKLine.h 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/4. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HYKLinePositionModel.h" 11 | #import "HYKLineModel.h" 12 | 13 | /************************K线的画笔************************/ 14 | @interface HYKLine : NSObject 15 | 16 | /** 17 | * K线模型 18 | */ 19 | @property(nonatomic,strong) HYKLinePositionModel *kLinePositionModel; 20 | 21 | /** 22 | * kLineModel模型 23 | */ 24 | @property(nonatomic,strong) HYKLineModel *kLineModel; 25 | 26 | /** 27 | * 最大的Y 28 | */ 29 | @property(nonatomic,assign) CGFloat maxY; 30 | 31 | /** 32 | * 根据context初始化 33 | */ 34 | -(instancetype)initWithContext:(CGContextRef)context; 35 | 36 | /** 37 | * 绘制K线 38 | */ 39 | -(UIColor *)draw; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Model/MJExtension/MJType.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJType.h 3 | // MJExtension 4 | // 5 | // Created by mj on 14-1-15. 6 | // Copyright (c) 2014年 itcast. All rights reserved. 7 | // 包装一种类型 8 | 9 | #import 10 | /** 11 | * 包装一种类型 12 | */ 13 | @interface MJType : NSObject 14 | /** 类型标识符 */ 15 | @property (nonatomic, copy) NSString *code; 16 | 17 | /** 是否为id类型 */ 18 | @property (nonatomic, readonly, getter=isIdType) BOOL idType; 19 | 20 | /** 对象类型(如果是基本数据类型,此值为nil) */ 21 | @property (nonatomic, readonly) Class typeClass; 22 | 23 | /** 类型是否来自于Foundation框架,比如NSString、NSArray */ 24 | @property (nonatomic, readonly, getter = isFromFoundation) BOOL fromFoundation; 25 | /** 类型是否不支持KVC */ 26 | @property (nonatomic, readonly, getter = isKVCDisabled) BOOL KVCDisabled; 27 | 28 | /** 29 | * 获得缓存的类型对象 30 | */ 31 | + (instancetype)cachedTypeWithCode:(NSString *)code; 32 | @end -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/StockChartView/SegmentView/HYStockChartSegmentView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYStockChartSegmentView.h 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/13. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol HYStockChartSegmentViewDelegate; 12 | @interface HYStockChartSegmentView : UIView 13 | 14 | /** 15 | * 通过items创建SegmentView 16 | */ 17 | -(instancetype)initWithItems:(NSArray *)items; 18 | 19 | 20 | @property(nonatomic,strong) NSArray *items; 21 | 22 | 23 | @property(nonatomic,weak) id delegate; 24 | 25 | @property(nonatomic,assign) NSUInteger selectedIndex; 26 | 27 | @end 28 | 29 | 30 | 31 | @protocol HYStockChartSegmentViewDelegate 32 | 33 | @optional 34 | -(void)hyStockChartSegmentView:(HYStockChartSegmentView *)segmentView clickSegmentButtonIndex:(NSInteger)index; 35 | 36 | @end -------------------------------------------------------------------------------- /RRStock/RRStock/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 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Model/MJExtension/NSObject+MJCoding.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+MJCoding.h 3 | // MJExtension 4 | // 5 | // Created by mj on 14-1-15. 6 | // Copyright (c) 2014年 itcast. All rights reserved. 7 | // 8 | 9 | #import 10 | /** 11 | * Codeing协议 12 | */ 13 | @protocol MJCoding 14 | @optional 15 | /** 16 | * 这个数组中的属性名将会被忽略:不进行归档 17 | */ 18 | + (NSArray *)ignoredCodingPropertyNames; 19 | @end 20 | 21 | @interface NSObject (MJCoding) 22 | /** 23 | * 解码(从文件中解析对象) 24 | */ 25 | - (void)decode:(NSCoder *)decoder; 26 | /** 27 | * 编码(将对象写入文件中) 28 | */ 29 | - (void)encode:(NSCoder *)encoder; 30 | @end 31 | 32 | /** 33 | 归档的实现 34 | */ 35 | #define MJCodingImplementation \ 36 | - (id)initWithCoder:(NSCoder *)decoder \ 37 | { \ 38 | if (self = [super init]) { \ 39 | [self decode:decoder]; \ 40 | } \ 41 | return self; \ 42 | } \ 43 | \ 44 | - (void)encodeWithCoder:(NSCoder *)encoder \ 45 | { \ 46 | [self encode:encoder]; \ 47 | } -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/KLine/AboveView/HYKLinePositionModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYKLinePositionModel.h 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/4. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | 13 | /************************K线数据模型************************/ 14 | @interface HYKLinePositionModel : NSObject 15 | 16 | /** 17 | * 开盘点 18 | */ 19 | @property(nonatomic,assign) CGPoint openPoint; 20 | 21 | /** 22 | * 收盘点 23 | */ 24 | @property(nonatomic,assign) CGPoint closePoint; 25 | 26 | /** 27 | * 最高点 28 | */ 29 | @property(nonatomic,assign) CGPoint highPoint; 30 | 31 | /** 32 | * 最低点 33 | */ 34 | @property(nonatomic,assign) CGPoint lowPoint; 35 | 36 | 37 | /** 38 | * 根据属性创建模型的工厂方法 39 | */ 40 | +(instancetype)modelWithOpen:(CGPoint)openPoint close:(CGPoint)closePoint high:(CGPoint)highPoint low:(CGPoint)lowPoint; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/KLine/MAView/HYKLineMAView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYKLineMAView.h 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/5/19. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /************************MAView的模型************************/ 12 | @interface HYKLineMAModel : NSObject 13 | 14 | @property(nonatomic,assign) CGFloat ma5Value; 15 | 16 | @property(nonatomic,assign) CGFloat ma10Value; 17 | 18 | @property(nonatomic,assign) CGFloat ma20Value; 19 | 20 | @property(nonatomic,assign) CGFloat ma30Value; 21 | 22 | +(instancetype)maModelWithMA5:(CGFloat)MA5 MA10:(CGFloat)MA10 MA20:(CGFloat)MA20 MA30:(CGFloat)MA30; 23 | 24 | @end 25 | 26 | /************************展示各种MA的View************************/ 27 | @interface HYKLineMAView : UIView 28 | 29 | @property(nonatomic,strong) HYKLineMAModel *maModel; 30 | 31 | /** 32 | * 创建HYKLineMAView的工厂方法 33 | */ 34 | +(instancetype)kLineMAView; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/KLine/KLineModel/HYKLineModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // HYKLineModel.m 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/4. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import "HYKLineModel.h" 10 | #import "MJExtension.h" 11 | 12 | @implementation HYKLineModel 13 | 14 | +(NSDictionary *)replacedKeyFromPropertyName 15 | { 16 | return @{@"date":@"Date", 17 | @"high":@"High", 18 | @"low":@"Low", 19 | @"close":@"Last", 20 | @"open":@"Open", 21 | @"volume":@"Volume", 22 | @"MA10":@"MA10", 23 | @"MA20":@"MA20", 24 | @"MA5":@"MA5", 25 | @"changeFromLastClose":@"ChangeFromLastClose", 26 | @"changeFromOpen":@"ChangeFromOpen", 27 | @"percentChangeFromLastClose":@"PercentChangeFromLastClose", 28 | @"percentChangeFromOpen":@"PercentChangeFromOpen" 29 | }; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /RRStock/RRStock/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 | -------------------------------------------------------------------------------- /RRStock/RRStockTests/RRStockTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // RRStockTests.m 3 | // RRStockTests 4 | // 5 | // Created by 曾文亮 on 16/11/24. 6 | // Copyright © 2016年 liang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface RRStockTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation RRStockTests 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 | -------------------------------------------------------------------------------- /RRStock/RRStock/RRStock_PrefixHeader.pch: -------------------------------------------------------------------------------- 1 | // 2 | // RRStock_PrefixHeader.pch 3 | // RRStock 4 | // 5 | // Created by 曾文亮 on 16/11/24. 6 | // Copyright © 2016年 liang. All rights reserved. 7 | // 8 | 9 | #ifndef RRStock_PrefixHeader_pch 10 | #define RRStock_PrefixHeader_pch 11 | 12 | // Include any system framework and library headers here that should be included in all compilation units. 13 | // You will also need to set the Prefix Header build setting of one or more of your targets to reference this file. 14 | 15 | #import "Masonry.h" 16 | #import "CustomLabel.h" 17 | #import "UIColor+Utils.h" 18 | 19 | #define WEAKSELF(weakSelf) __weak __typeof(&*self)weakSelf = self; 20 | 21 | static NSString *const kGoTopNotificationName = @"goTop";//进入置顶命令 22 | static NSString *const kLeaveTopNotificationName = @"leaveTop";//离开置顶命令 23 | 24 | static NSString *const CanAcceptTouchNotificationName = @"canAcceptTouch";//可以接受触摸 25 | //屏幕宽度 26 | #define ScreenW [UIScreen mainScreen].bounds.size.width 27 | 28 | //屏幕高度 29 | #define ScreenH [UIScreen mainScreen].bounds.size.height 30 | 31 | #endif /* RRStock_PrefixHeader_pch */ 32 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/GloablVariable/HYStockChartGloablVariable.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYStockChartGloablVariable.h 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/7. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef NS_ENUM(NSInteger, HYStockType) 12 | { 13 | HYStockTypeUSA, //美股 14 | HYStockTypeA, //A股 15 | HYStockTypeHK, //港股 16 | }; 17 | 18 | @interface HYStockChartGloablVariable : NSObject 19 | 20 | /** 21 | * K线图的宽度,默认20 22 | */ 23 | +(CGFloat)kLineWidth; 24 | +(void)setkLineWith:(CGFloat)kLineWidth; 25 | 26 | /** 27 | * K线图的间隔,默认1 28 | */ 29 | +(CGFloat)kLineGap; 30 | +(void)setkLineGap:(CGFloat)kLineGap; 31 | 32 | 33 | /** 34 | * 股票中文名 35 | */ 36 | +(NSString *)stockChineseName; 37 | +(void)setStockChineseName:(NSString *)chineseName; 38 | 39 | /** 40 | * 股票代号 41 | */ 42 | +(NSString *)stockSymbol; 43 | +(void)setStockSymbol:(NSString *)symbol; 44 | 45 | /** 46 | * 股票类型 47 | */ 48 | +(void)setStockType:(HYStockType)stockType; 49 | +(HYStockType)stockType; 50 | 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /RRStock/RRStock/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. -------------------------------------------------------------------------------- /RRStock/RRStock/DetailViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DetailViewController.m 3 | // RRStock 4 | // 5 | // Created by 曾文亮 on 16/11/24. 6 | // Copyright © 2016年 liang. All rights reserved. 7 | // 8 | 9 | #import "DetailViewController.h" 10 | 11 | @interface DetailViewController () 12 | 13 | @end 14 | 15 | @implementation DetailViewController 16 | 17 | #pragma mark - Managing the detail item 18 | 19 | - (void)setDetailItem:(id)newDetailItem { 20 | if (_detailItem != newDetailItem) { 21 | _detailItem = newDetailItem; 22 | 23 | // Update the view. 24 | [self configureView]; 25 | } 26 | } 27 | 28 | - (void)configureView { 29 | // Update the user interface for the detail item. 30 | if (self.detailItem) { 31 | self.detailDescriptionLabel.text = [self.detailItem description]; 32 | } 33 | } 34 | 35 | - (void)viewDidLoad { 36 | [super viewDidLoad]; 37 | // Do any additional setup after loading the view, typically from a nib. 38 | [self configureView]; 39 | } 40 | 41 | - (void)didReceiveMemoryWarning { 42 | [super didReceiveMemoryWarning]; 43 | // Dispose of any resources that can be recreated. 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/Category/UIFont+Extension/UIFont+HYStockChart.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIFont+Extension.h 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/5/12. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIFont (HYStockChart) 12 | 13 | //根据标注图封装的字体,数字之间的-省略 14 | /** 15 | * 1系列字体 16 | */ 17 | +(UIFont *)f11Font; 18 | +(UIFont *)f12Font; 19 | +(UIFont *)f13Font; 20 | +(UIFont *)f14Font; 21 | +(UIFont *)f15Font; 22 | +(UIFont *)f16Font; 23 | +(UIFont *)f17Font; 24 | +(UIFont *)f18Font; 25 | +(UIFont *)f19Font; 26 | +(UIFont *)f110Font; 27 | 28 | /** 29 | * 2系列的字体 30 | */ 31 | +(UIFont *)f21Font; 32 | +(UIFont *)f22Font; 33 | +(UIFont *)f23Font; 34 | +(UIFont *)f24Font; 35 | +(UIFont *)f25Font; 36 | 37 | /** 38 | * 3系列的字体 39 | */ 40 | +(UIFont *)f31Font; 41 | +(UIFont *)f32Font; 42 | +(UIFont *)f33Font; 43 | +(UIFont *)f34Font; 44 | +(UIFont *)f35Font; 45 | +(UIFont *)f36Font; 46 | +(UIFont *)f37Font; 47 | +(UIFont *)f38Font; 48 | +(UIFont *)f39Font; 49 | +(UIFont *)f310Font; 50 | +(UIFont *)f311Font; 51 | +(UIFont *)f312Font; 52 | 53 | /** 54 | * 4系列字体 55 | */ 56 | +(UIFont *)f41Font; 57 | 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Controller/RRStockChartView.h: -------------------------------------------------------------------------------- 1 | // 2 | // RRStockChartView.h 3 | // HYStockChartDemo 4 | // 5 | // Created by 人人操盘 on 16/9/1. 6 | // Copyright © 2016年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HYStockChartConstant.h" 11 | #import "HYStockChartView.h" 12 | 13 | @protocol HYStockChartViewDataSource; 14 | 15 | /************************展示K线、成交量、趋势图、各种数据的最终的View************************/ 16 | @interface RRStockChartView : UIView 17 | 18 | @property(nonatomic,strong) NSArray *itemModels; 19 | 20 | /** 21 | * 数据源 22 | */ 23 | @property(nonatomic,weak) id dataSource; 24 | 25 | /** 26 | * 选中的索引 27 | */ 28 | @property(nonatomic,assign,readonly) NSInteger currentIndex; 29 | 30 | /** 31 | * 股票简介模型 32 | */ 33 | //@property(nonatomic,strong) HYStockChartProfileModel *stockChartProfileModel; 34 | 35 | 36 | /** 37 | * 重新加载数据 38 | */ 39 | -(void)reloadData; 40 | 41 | 42 | @end 43 | 44 | /************************数据源************************/ 45 | @protocol HYStockChartViewDataSource 46 | 47 | @required 48 | /** 49 | * 某个index指定的数据 50 | */ 51 | -(id)stockDatasWithIndex:(NSInteger)index; 52 | 53 | @end 54 | 55 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Model/TimeLineModel/JMSTimeLineModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // JMSTimeLineModel.h 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/5/8. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /************************分时线的Model************************/ 12 | @interface JMSTimeLineModel : NSObject 13 | 14 | @property(nonatomic,assign) CGFloat Close; 15 | 16 | @property(nonatomic,copy) NSString *EndDate; 17 | 18 | @property(nonatomic,copy) NSString *EndTime; 19 | 20 | @property(nonatomic,assign) CGFloat High; 21 | 22 | @property(nonatomic,assign) CGFloat Low; 23 | 24 | @property(nonatomic,assign) CGFloat Open; 25 | 26 | @property(nonatomic,copy) NSString *StartDate; 27 | 28 | @property(nonatomic,copy) NSString *StartTime; 29 | 30 | @property(nonatomic,assign) NSInteger Volume; 31 | 32 | @property(nonatomic,assign) CGFloat VWAP; 33 | 34 | @property(nonatomic,assign) CGFloat UTCOffset; 35 | 36 | @property(nonatomic,assign) CGFloat Trades; 37 | 38 | @property(nonatomic,assign) CGFloat TWAP; 39 | 40 | @property(nonatomic,assign) CGFloat ChangeFromPreClose; 41 | 42 | @property(nonatomic,assign) CGFloat PercentChangeFromPreClose; 43 | 44 | 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /RRStock/RRStock/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 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/TimeLine/BelowView/HYTimeLineBelowView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYTimeLineBelowView.h 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/8. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HYTimeLineAboveView.h" 11 | #import "HYStockChartConstant.h" 12 | #import "YYTimeLineBelowMaskView.h" 13 | 14 | @class HYTimeLineModel; 15 | /************************分时线下面的view************************/ 16 | @interface HYTimeLineBelowView : UIView 17 | 18 | @property(nonatomic,strong) NSArray *timeLineModels; 19 | 20 | //x轴的位置数组 21 | @property(nonatomic,strong) NSArray *xPositionArray; 22 | 23 | @property(nonatomic,assign) HYStockChartCenterViewType centerViewType; 24 | 25 | //显示颜色数组 26 | @property(nonatomic,strong) NSArray *colorArray; 27 | 28 | @property (nonatomic,strong)YYTimeLineBelowMaskView *maskView; 29 | 30 | //选中的点和位置 31 | -(void)timeLineAboveViewLongPressLineModel:(HYTimeLineModel *)selectedModel selectPoint:(CGPoint)selectedPoint; 32 | 33 | /** 34 | * 画下面的view 35 | */ 36 | -(void)drawBelowView; 37 | 38 | /** 39 | * 根据指定颜色清除背景 40 | */ 41 | -(void)clearRectWithColor:(UIColor *)bgColor NS_DEPRECATED_IOS(2_0,2_0,"这个方法暂时没有实现!"); 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Tools/UIColor+CZ/UIColor+Utils.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor+Utils.h 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 16/3/21. 6 | // Copyright © 2016年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIColor (Utils) 12 | /** 13 | 将16进制颜色值如#000000转换成UIColor 14 | **/ 15 | + (UIColor*)colorWithHexString:(NSString *)stringToConvert; 16 | + (UIColor*)colorWithHexString:(NSString *)stringToConvert alpha:(float)_alpha; 17 | 18 | + (UIColor *)colorWithLightBlue; 19 | 20 | + (UIColor *)colorWithLightYellow; 21 | 22 | + (UIColor *)colorWithWhite51; 23 | 24 | + (UIColor *)colorWithWhite102; 25 | 26 | + (UIColor *)colorWithWhite242; 27 | 28 | + (UIColor *)colorWithWhite245; 29 | 30 | + (UIColor *)colorWithWhite196; 31 | 32 | + (UIColor *)colorWithWhite153; 33 | 34 | + (UIColor *)colorWithNavBarColor; 35 | 36 | + (UIColor *)colorWithWhite226; 37 | 38 | + (UIColor *)ColorWithWhite204; 39 | 40 | + (UIColor *)colorWithRateRed; 41 | 42 | + (UIColor *)ColorWithLightGreen; 43 | 44 | + (UIColor *)colorWithLightHighBlue; 45 | 46 | //随机颜色 47 | + (UIColor *)randomColor; 48 | 49 | + (UIColor *)rgbaColor:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha; 50 | 51 | + (BOOL) isTheSameColor2:(UIColor*)color1 anotherColor:(UIColor*)color2; 52 | @end 53 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Model/MJExtension/MJFoundation.m: -------------------------------------------------------------------------------- 1 | // 2 | // MJFoundation.m 3 | // MJExtensionExample 4 | // 5 | // Created by MJ Lee on 14/7/16. 6 | // Copyright (c) 2014年 itcast. All rights reserved. 7 | // 8 | 9 | #import "MJFoundation.h" 10 | #import "MJConst.h" 11 | #import 12 | 13 | static NSSet *_foundationClasses; 14 | 15 | @implementation MJFoundation 16 | 17 | + (void)load 18 | { 19 | _foundationClasses = [NSSet setWithObjects: 20 | [NSObject class], 21 | [NSURL class], 22 | [NSDate class], 23 | [NSNumber class], 24 | [NSDecimalNumber class], 25 | [NSData class], 26 | [NSMutableData class], 27 | [NSArray class], 28 | [NSMutableArray class], 29 | [NSDictionary class], 30 | [NSMutableDictionary class], 31 | [NSManagedObject class], 32 | [NSString class], 33 | [NSMutableString class], nil]; 34 | } 35 | 36 | + (BOOL)isClassFromFoundation:(Class)c 37 | { 38 | return [_foundationClasses containsObject:c]; 39 | } 40 | @end 41 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/KLine/KLineModel/HYKLineModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYKLineModel.h 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/4. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface HYKLineModel : NSObject 13 | 14 | /** 15 | * 这个日期的格式必须为MM/dd/yyyy 16 | */ 17 | @property(nonatomic,copy) NSString *date; 18 | 19 | @property(nonatomic,assign) CGFloat high; 20 | 21 | @property(nonatomic,assign) CGFloat low; 22 | 23 | @property(nonatomic,assign) CGFloat open; 24 | 25 | @property(nonatomic,assign) CGFloat close; 26 | 27 | @property(nonatomic,assign) CGFloat volume; 28 | //10日平均线 29 | @property(nonatomic,assign) CGFloat MA10; 30 | //20日平均线 31 | @property(nonatomic,assign) CGFloat MA20; 32 | //5日平均线 33 | @property(nonatomic,assign) CGFloat MA5; 34 | 35 | @property(nonatomic,assign) CGFloat MA30; 36 | 37 | @property(nonatomic,assign) CGFloat changeFromLastClose; 38 | 39 | @property(nonatomic,assign) CGFloat changeFromOpen; 40 | 41 | @property(nonatomic,assign) CGFloat percentChangeFromLastClose; 42 | 43 | @property(nonatomic,assign) CGFloat percentChangeFromOpen; 44 | 45 | /** 46 | * 是否是某个月的第一个交易日 47 | */ 48 | @property(nonatomic,assign) BOOL isFirstTradeDate; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /RRStock/RRStockUITests/RRStockUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // RRStockUITests.m 3 | // RRStockUITests 4 | // 5 | // Created by 曾文亮 on 16/11/24. 6 | // Copyright © 2016年 liang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface RRStockUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation RRStockUITests 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 | -------------------------------------------------------------------------------- /RRStock/RRStock/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 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Model/MJExtension/NSObject+MJCoding.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+MJCoding.m 3 | // MJExtension 4 | // 5 | // Created by mj on 14-1-15. 6 | // Copyright (c) 2014年 itcast. All rights reserved. 7 | // 8 | 9 | #import "NSObject+MJCoding.h" 10 | #import "NSObject+MJProperty.h" 11 | #import "MJProperty.h" 12 | 13 | @implementation NSObject (MJCoding) 14 | 15 | - (void)encode:(NSCoder *)encoder 16 | { 17 | NSArray *ignoredCodingPropertyNames = [[self class] totalIgnoredCodingPropertyNames]; 18 | 19 | [[self class] enumeratePropertiesWithBlock:^(MJProperty *property, BOOL *stop) { 20 | // 检测是否被忽略 21 | if ([ignoredCodingPropertyNames containsObject:property.name]) return; 22 | 23 | id value = [property valueFromObject:self]; 24 | if (value == nil) return; 25 | [encoder encodeObject:value forKey:property.name]; 26 | }]; 27 | } 28 | 29 | - (void)decode:(NSCoder *)decoder 30 | { 31 | NSArray *ignoredCodingPropertyNames = [[self class] totalIgnoredCodingPropertyNames]; 32 | 33 | [[self class] enumeratePropertiesWithBlock:^(MJProperty *property, BOOL *stop) { 34 | // 检测是否被忽略 35 | if ([ignoredCodingPropertyNames containsObject:property.name]) return; 36 | 37 | id value = [decoder decodeObjectForKey:property.name]; 38 | if (value == nil) return; 39 | [property setValue:value forObject:self]; 40 | }]; 41 | } 42 | @end 43 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Model/MJExtension/MJProperty.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJProperty.h 3 | // MJExtensionExample 4 | // 5 | // Created by MJ Lee on 15/4/17. 6 | // Copyright (c) 2015年 itcast. All rights reserved. 7 | // 包装一个成员属性 8 | 9 | #import 10 | #import 11 | @class MJType; 12 | 13 | /** 14 | * 包装一个成员 15 | */ 16 | @interface MJProperty : NSObject 17 | /** 成员属性 */ 18 | @property (nonatomic, assign) objc_property_t property; 19 | /** 成员属性名 */ 20 | @property (nonatomic, readonly) NSString *name; 21 | 22 | /** 成员变量的类型 */ 23 | @property (nonatomic, readonly) MJType *type; 24 | /** 成员来源于哪个类(可能是父类) */ 25 | @property (nonatomic, assign) Class srcClass; 26 | 27 | /**** 同一个成员变量 - 父类和子类的行为可能不一致(key、keys、objectClassInArray) ****/ 28 | /** 对应着字典中的key */ 29 | - (void)setKey:(NSString *)key forClass:(Class)c; 30 | - (NSString *)keyFromClass:(Class)c; 31 | 32 | /** 对应着字典中的多级key */ 33 | - (NSArray *)keysFromClass:(Class)c; 34 | 35 | /** 模型数组中的模型类型 */ 36 | - (void)setObjectClassInArray:(Class)objectClass forClass:(Class)c; 37 | - (Class)objectClassInArrayFromClass:(Class)c; 38 | /**** 同一个成员变量 - 父类和子类的行为可能不一致(key、keys、objectClassInArray) ****/ 39 | 40 | /** 41 | * 设置成员变量的值 42 | */ 43 | - (void)setValue:(id)value forObject:(id)object; 44 | /** 45 | * 得到成员变量的值 46 | */ 47 | - (id)valueFromObject:(id)object; 48 | 49 | /** 50 | * 初始化 51 | */ 52 | + (instancetype)cachedPropertyWithProperty:(objc_property_t)property; 53 | @end 54 | -------------------------------------------------------------------------------- /RRStock/RRStock/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 | -------------------------------------------------------------------------------- /RRStock/RRStock/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 | -------------------------------------------------------------------------------- /RRStock/RRStock/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 | -------------------------------------------------------------------------------- /RRStock/RRStock/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "83.5x83.5", 66 | "scale" : "2x" 67 | } 68 | ], 69 | "info" : { 70 | "version" : 1, 71 | "author" : "xcode" 72 | } 73 | } -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/TimeLine/BelowView/HYTimeLineVolume.m: -------------------------------------------------------------------------------- 1 | // 2 | // HYTimeLineVolume.m 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/11. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import "HYTimeLineVolume.h" 10 | #import "HYStockChartConstant.h" 11 | #import "HYTimeLineBelowPositionModel.h" 12 | #import "UIColor+HYStockChart.h" 13 | 14 | @interface HYTimeLineVolume() 15 | 16 | @property(nonatomic,assign) CGContextRef context; 17 | 18 | @end 19 | 20 | @implementation HYTimeLineVolume 21 | 22 | -(instancetype)initWithContext:(CGContextRef)context 23 | { 24 | self = [super init]; 25 | if (self) { 26 | _context = context; 27 | } 28 | return self; 29 | } 30 | 31 | -(void)draw 32 | { 33 | NSAssert(self.timeLineVolumnPositionModels && self.context, @"timeLineVolumnPositionModels不能为空!"); 34 | CGContextRef context = self.context; 35 | CGFloat volumeLineWidth = self.currentXWidth / self.timeLineVolumnPositionModels.count - 1.0; 36 | CGContextSetLineWidth(self.context, volumeLineWidth); 37 | NSInteger index = 0; 38 | for (HYTimeLineBelowPositionModel *positionModel in self.timeLineVolumnPositionModels) { 39 | 40 | UIColor *color = self.colorArray[index]; 41 | CGContextSetStrokeColorWithColor(self.context, color.CGColor); 42 | //画实体线 43 | const CGPoint solidPoints[] = {positionModel.startPoint,positionModel.endPoint}; 44 | CGContextStrokeLineSegments(context, solidPoints, 2); 45 | index ++; 46 | } 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Model/MJExtension/MJType.m: -------------------------------------------------------------------------------- 1 | // 2 | // MJType.m 3 | // MJExtension 4 | // 5 | // Created by mj on 14-1-15. 6 | // Copyright (c) 2014年 itcast. All rights reserved. 7 | // 8 | 9 | #import "MJType.h" 10 | #import "MJExtension.h" 11 | #import "MJFoundation.h" 12 | #import "MJConst.h" 13 | 14 | @implementation MJType 15 | 16 | static NSMutableDictionary *_cachedTypes; 17 | + (void)load 18 | { 19 | _cachedTypes = [NSMutableDictionary dictionary]; 20 | } 21 | 22 | + (instancetype)cachedTypeWithCode:(NSString *)code 23 | { 24 | MJAssertParamNotNil2(code, nil); 25 | 26 | MJType *type = _cachedTypes[code]; 27 | if (type == nil) { 28 | type = [[self alloc] init]; 29 | type.code = code; 30 | _cachedTypes[code] = type; 31 | } 32 | return type; 33 | } 34 | 35 | - (void)setCode:(NSString *)code 36 | { 37 | _code = code; 38 | 39 | MJAssertParamNotNil(code); 40 | 41 | if ([code isEqualToString:MJTypeId]) { 42 | _idType = YES; 43 | } else if (code.length == 0) { 44 | _KVCDisabled = YES; 45 | } else if (code.length > 3 && [code hasPrefix:@"@\""]) { 46 | // 去掉@"和",截取中间的类型名称 47 | _code = [code substringWithRange:NSMakeRange(2, code.length - 3)]; 48 | _typeClass = NSClassFromString(_code); 49 | _fromFoundation = [MJFoundation isClassFromFoundation:_typeClass]; 50 | } else if ([code isEqualToString:MJTypeSEL] || 51 | [code isEqualToString:MJTypeIvar] || 52 | [code isEqualToString:MJTypeMethod]) { 53 | _KVCDisabled = YES; 54 | } 55 | } 56 | @end 57 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Tools/UIButton+CZ/UIButton+CZ.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIButton+CZ.m 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 15/11/23. 6 | // Copyright © 2015年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import "UIButton+CZ.h" 10 | 11 | @implementation UIButton (CZ) 12 | 13 | + (UIButton *)setCustomButton:(NSString *)title backGroundColor:(UIColor *)backGroundColor backGroundImage:(UIImage *)image textColor:(UIColor *)textColor textFont:(CGFloat)font 14 | { 15 | UIButton *customButton = [[UIButton alloc] init]; 16 | [customButton setTitle:title forState:UIControlStateNormal]; 17 | [customButton setTitleColor:textColor forState:UIControlStateNormal]; 18 | [customButton setBackgroundImage:image forState:UIControlStateNormal]; 19 | [customButton setBackgroundColor:backGroundColor]; 20 | customButton.titleLabel.font = [UIFont systemFontOfSize:font]; 21 | return customButton; 22 | } 23 | 24 | + (UIButton *)setIcon:(UIImage *)image setSelectedIcon:(UIImage *)selectedImage sethighLightIcon:(UIImage *)highLightImage{ 25 | UIButton *customButton = [[UIButton alloc] init]; 26 | [customButton setImage:image forState:UIControlStateNormal]; 27 | [customButton setImage:selectedImage forState:UIControlStateSelected]; 28 | [customButton setImage:highLightImage forState:UIControlStateHighlighted]; 29 | return customButton; 30 | } 31 | 32 | //- (CGRect)titleRectForContentRect:(CGRect)contentRect 33 | //{ 34 | // 35 | // CGFloat x = contentRect.origin.x; 36 | // CGRect customRect = CGRectMake(x + 5, contentRect.origin.y, contentRect.size.width, contentRect.size.height); 37 | // 38 | // return customRect; 39 | //} 40 | 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/StockChartView/HYStockChartView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYStockChartView.h 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/4. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HYStockChartConstant.h" 11 | 12 | @class HYStockChartProfileModel; 13 | 14 | /************************ItemModel类************************/ 15 | @interface HYStockChartViewItemModel : NSObject 16 | @property(nonatomic,copy) NSString *title; 17 | @property(nonatomic,assign) HYStockChartCenterViewType centerViewType; 18 | +(instancetype)itemModelWithTitle:(NSString *)title type:(HYStockChartCenterViewType)type; 19 | @end 20 | 21 | 22 | @protocol HYStockChartViewDataSource; 23 | /************************展示K线、成交量、趋势图、各种数据的最终的View************************/ 24 | @interface HYStockChartView : UIView 25 | 26 | @property(nonatomic,strong) NSArray *itemModels; 27 | 28 | /** 29 | * 数据源 30 | */ 31 | @property(nonatomic,weak) id dataSource; 32 | 33 | /** 34 | * 选中的索引 35 | */ 36 | @property(nonatomic,assign,readonly) NSInteger currentIndex; 37 | 38 | /** 39 | * 股票简介模型 40 | */ 41 | @property(nonatomic,strong) HYStockChartProfileModel *stockChartProfileModel; 42 | 43 | 44 | /** 45 | * 重新加载数据 46 | */ 47 | -(void)reloadData; 48 | 49 | @end 50 | 51 | 52 | /************************代理************************/ 53 | @protocol HYStockChartViewDelegate 54 | @end 55 | 56 | /************************数据源************************/ 57 | @protocol HYStockChartViewDataSource 58 | 59 | @required 60 | /** 61 | * 某个index指定的数据 62 | */ 63 | -(id)stockDatasWithIndex:(NSInteger)index; 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/Category/UIColor+HYStockChart/UIColor+HYStockChart.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor+HYStockChartExtension.h 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/5/25. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIColor (HYStockChart) 12 | 13 | /** 14 | * 根据十六进制转换成UIColor 15 | * 16 | * @param hex UIColor的十六进制 17 | * 18 | * @return 转换后的结果 19 | */ 20 | +(UIColor *)colorWithRGBHex:(UInt32)hex; 21 | 22 | #pragma mark 153颜色 23 | +(UIColor *)whiteColor153; 24 | 25 | 26 | /** 27 | * 所有图表的背景颜色 28 | */ 29 | +(UIColor *)backgroundColor; 30 | 31 | /** 边框线颜色*/ 32 | +(UIColor *)gridLineColor; 33 | 34 | /** 35 | * 辅助背景色 36 | */ 37 | +(UIColor *)assistBackgroundColor; 38 | 39 | /** 40 | * 涨的颜色 41 | */ 42 | +(UIColor *)increaseColor; 43 | 44 | 45 | /** 46 | * 跌的颜色 47 | */ 48 | +(UIColor *)decreaseColor; 49 | 50 | /** 51 | * 主文字颜色 52 | */ 53 | +(UIColor *)mainTextColor; 54 | 55 | /** 56 | * 辅助文字颜色 57 | */ 58 | +(UIColor *)assistTextColor; 59 | 60 | /** 61 | * 分时线下面的成交量线的颜色 62 | */ 63 | +(UIColor *)timeLineVolumeLineColor; 64 | 65 | /** 66 | * 分时线界面线的颜色 67 | */ 68 | +(UIColor *)timeLineLineColor; 69 | 70 | /** 71 | * 长按时线的颜色 72 | */ 73 | +(UIColor *)longPressLineColor; 74 | 75 | /** 76 | * ma5的颜色 77 | */ 78 | +(UIColor *)ma5Color; 79 | 80 | /** 81 | * ma10的颜色 82 | */ 83 | +(UIColor *)ma10Color; 84 | 85 | /** 86 | * ma20颜色 87 | */ 88 | +(UIColor *)ma20Color; 89 | 90 | /** 91 | * ma30颜色 92 | */ 93 | +(UIColor *)ma30Color; 94 | 95 | /** 96 | * 分时图渐变色 97 | */ 98 | +(UIColor *)fenShiGradientColor; 99 | 100 | 101 | @end 102 | -------------------------------------------------------------------------------- /RRStock/RRStock/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 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/TimeLine/AboveView/HYTimeLineAboveView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYTimeLineAboveView.h 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/8. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HYStockChartConstant.h" 11 | 12 | @class HYTimeLineGroupModel; 13 | @protocol HYTimeLineAboveViewDelegate; 14 | @class HYTimeLineModel; 15 | /************************分时线上面的view************************/ 16 | @interface HYTimeLineAboveView : UIView 17 | 18 | /** 19 | * 分时线的模型 20 | */ 21 | @property(nonatomic,strong) HYTimeLineGroupModel *groupModel; 22 | 23 | @property(nonatomic,assign) HYStockChartCenterViewType centerViewType; 24 | 25 | @property(nonatomic,weak) id delegate; 26 | 27 | /** 是否展示结束点*/ 28 | @property (nonatomic,assign)BOOL endPointShowEnabled; 29 | 30 | /** 31 | * 画AboveView 32 | */ 33 | -(void)drawAboveView; 34 | 35 | /** 36 | * 根据指定颜色清除背景 37 | */ 38 | //-(void)clearRectWithColor:(UIColor *)bgColor NS_DEPRECATED_IOS(2_0,2_0,"这个方法暂时没有实现!"); 39 | 40 | /** 41 | * 长按的时候根据原始的x的位置获得精确的X的位置 42 | */ 43 | -(CGPoint)getRightXPositionWithOriginXPosition:(CGFloat)originXPosition; 44 | 45 | -(NSInteger)getPositionWithOriginXPosition:(CGFloat)originXPosition; 46 | 47 | 48 | @end 49 | 50 | 51 | @protocol HYTimeLineAboveViewDelegate 52 | 53 | @optional 54 | 55 | //所有的位置点 56 | -(void)timeLineAboveView:(UIView *)timeLineAboveView positionModels:(NSArray *)positionModels colorModels:(NSArray *)colorModels; 57 | 58 | //长按时当前位置的信息 59 | -(void)timeLineAboveViewLongPressTimeLineModel:(HYTimeLineModel *)timeLineModel; 60 | 61 | -(void)timeLineAboveViewLongPressDismiss; 62 | 63 | //选中的点和位置 64 | -(void)timeLineAboveViewLongPressAboveLineModel:(HYTimeLineModel *)selectedModel selectPoint:(CGPoint)selectedPoint; 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /RRStock/RRStock/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UIStatusBarTintParameters 34 | 35 | UINavigationBar 36 | 37 | Style 38 | UIBarStyleDefault 39 | Translucent 40 | 41 | 42 | 43 | UISupportedInterfaceOrientations 44 | 45 | UIInterfaceOrientationPortrait 46 | UIInterfaceOrientationLandscapeLeft 47 | UIInterfaceOrientationLandscapeRight 48 | 49 | UISupportedInterfaceOrientations~ipad 50 | 51 | UIInterfaceOrientationPortrait 52 | UIInterfaceOrientationPortraitUpsideDown 53 | UIInterfaceOrientationLandscapeLeft 54 | UIInterfaceOrientationLandscapeRight 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Tools/UIView+Extension/UIView+Extension.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+Extension.m 3 | // RRCP 4 | // 5 | // Created by zwl on 15/11/2. 6 | // Copyright © 2015年 qinxin. All rights reserved. 7 | // 8 | 9 | #import "UIView+Extension.h" 10 | 11 | @implementation UIView (Extension) 12 | 13 | - (void)setCenterX:(CGFloat)centerX 14 | { 15 | CGPoint tempCenter = self.center; 16 | tempCenter.x = centerX; 17 | self.center = tempCenter; 18 | } 19 | 20 | - (CGFloat)centerX 21 | { 22 | return self.center.x; 23 | } 24 | 25 | - (void)setCenterY:(CGFloat)centerY 26 | { 27 | CGPoint tempCenter = self.center; 28 | tempCenter.y = centerY; 29 | self.center = tempCenter; 30 | } 31 | 32 | - (CGFloat)centerY 33 | { 34 | return self.center.y; 35 | } 36 | 37 | - (void)setX:(CGFloat)x 38 | { 39 | CGRect tempFrame = self.frame; 40 | tempFrame.origin.x = x; 41 | self.frame = tempFrame; 42 | } 43 | 44 | - (CGFloat)x 45 | { 46 | return self.frame.origin.x; 47 | } 48 | 49 | - (void)setY:(CGFloat)y 50 | { 51 | CGRect tempFrame = self.frame; 52 | tempFrame.origin.y = y; 53 | self.frame = tempFrame; 54 | } 55 | 56 | - (CGFloat)y 57 | { 58 | return self.frame.origin.y; 59 | } 60 | 61 | - (void)setWidth:(CGFloat)width 62 | { 63 | CGRect tempFrame = self.frame; 64 | tempFrame.size.width = width; 65 | self.frame = tempFrame; 66 | } 67 | 68 | - (CGFloat)width 69 | { 70 | return self.frame.size.width; 71 | } 72 | 73 | - (void)setHeight:(CGFloat)height 74 | { 75 | CGRect tempFrame = self.frame; 76 | tempFrame.size.height = height; 77 | self.frame = tempFrame; 78 | } 79 | 80 | - (CGFloat)height 81 | { 82 | return self.frame.size.height; 83 | } 84 | 85 | - (void)setSize:(CGSize)size 86 | { 87 | CGRect tempFrame = self.frame; 88 | tempFrame.size = size; 89 | self.frame = tempFrame; 90 | } 91 | 92 | - (CGSize)size 93 | { 94 | return self.frame.size; 95 | } 96 | 97 | @end 98 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/KLine/BelowView/HYKLineBelowView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYKLineVolumeView.h 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/7. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HYKLinePositionModel.h" 11 | #import "HYKLineModel.h" 12 | 13 | @protocol HYKLineBelowViewDelegate; 14 | 15 | /************************下面的图(成交量/平均线)************************/ 16 | @interface HYKLineBelowView : UIView 17 | 18 | /** 19 | * 需要画出来的k线的模型数组 20 | */ 21 | @property(nonatomic,strong) NSArray *needDrawKLineModels; 22 | 23 | /** 24 | * 需要绘制的K线的X位置的数组 25 | */ 26 | @property(nonatomic,strong) NSArray *needDrawKLinePositionModels; 27 | 28 | 29 | /** 30 | * 需要绘制的成交量的位置模型数组 31 | */ 32 | @property(nonatomic,strong) NSArray *needDrawKLineVolumePositionModels; 33 | 34 | /** 35 | * K线的颜色 36 | */ 37 | @property(nonatomic,strong) NSArray *kLineColors; 38 | 39 | /** 40 | * 代理 41 | */ 42 | @property(nonatomic,weak) id delegate; 43 | 44 | /** 45 | * 根据指定颜色清除背景 46 | */ 47 | -(void)clearRectWithColor:(UIColor *)bgColor NS_DEPRECATED_IOS(2_0,2_0,"这个方法暂时没有实现!"); 48 | 49 | /** 50 | * 长按的时候根据原始的x的位置获得精确的位置 51 | */ 52 | -(CGPoint)kLineBelowViewLongPressKLinePositionModel:(HYKLinePositionModel *)kLinePositionModel kLineModel:(HYKLineModel *)kLineModel; 53 | 54 | /** 55 | * 绘制BelowView 56 | */ 57 | -(void)drawBelowView; 58 | 59 | @end 60 | 61 | 62 | /************************HYKLineBelowView的代理方法************************/ 63 | @protocol HYKLineBelowViewDelegate 64 | 65 | @optional 66 | /** 67 | * 绘制的成交量中最大的成交量和最小的成交量 68 | */ 69 | -(void)kLineBelowViewCurrentMaxVolume:(CGFloat)maxVolume minVolume:(CGFloat)minVolume; 70 | 71 | /** 72 | * 长按后展示手指按着的HYKLinePositionModel和HYKLineModel 73 | */ 74 | -(void)kLineBelowViewLongPressKLinePositionModel:(HYKLinePositionModel *)kLinePositionModel kLineModel:(HYKLineModel *)kLineModel; 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/TimeLine/TradeDetailTableView.m: -------------------------------------------------------------------------------- 1 | // 2 | // TradeDetailTableView.m 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 16/8/23. 6 | // Copyright © 2016年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import "TradeDetailTableView.h" 10 | #import "TradeDetailCell.h" 11 | 12 | @interface TradeDetailTableView () 13 | 14 | @end 15 | 16 | #define TradeDetailCellIdentifer @"TradeDetailCellIdentifer" 17 | @implementation TradeDetailTableView 18 | 19 | - (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style 20 | { 21 | self = [super initWithFrame:frame style:style]; 22 | if (self) { 23 | 24 | self.dataSource = self; 25 | self.delegate = self; 26 | 27 | self.separatorStyle = UITableViewCellSeparatorStyleNone; 28 | [self registerClass:[TradeDetailCell class] forCellReuseIdentifier:TradeDetailCellIdentifer]; 29 | } 30 | return self; 31 | } 32 | 33 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 34 | { 35 | 36 | return 2; 37 | } 38 | 39 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 40 | { 41 | 42 | return 5; 43 | 44 | } 45 | 46 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 47 | { 48 | TradeDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:TradeDetailCellIdentifer]; 49 | return cell; 50 | 51 | 52 | } 53 | 54 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 55 | { 56 | 57 | return self.frame.size.height / 10; 58 | } 59 | 60 | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section 61 | { 62 | 63 | 64 | return 0.001f; 65 | 66 | } 67 | 68 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section 69 | { 70 | 71 | return 0.01f; 72 | } 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/KLine/AboveView/HYMALine.m: -------------------------------------------------------------------------------- 1 | // 2 | // HYMALine.m 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/5/28. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import "HYMALine.h" 10 | #import "HYKLineModel.h" 11 | #import "UIColor+HYStockChart.h" 12 | #import "HYStockChartConstant.h" 13 | 14 | @interface HYMALine () 15 | 16 | @property(nonatomic,assign) CGContextRef context; 17 | 18 | @end 19 | 20 | @implementation HYMALine 21 | 22 | /** 23 | * 根据context初始化均线画笔 24 | */ 25 | -(instancetype)initWitContext:(CGContextRef)context 26 | { 27 | self = [super init]; 28 | if (self) { 29 | self.context = context; 30 | } 31 | return self; 32 | } 33 | 34 | -(void)draw 35 | { 36 | if (!self.context || !self.MAPositions) { 37 | return; 38 | } 39 | 40 | UIColor *lineColor = nil; 41 | switch (self.MAType) { 42 | case HYMA5Type: 43 | lineColor = [UIColor ma5Color]; 44 | break; 45 | case HYMA10Type: 46 | lineColor = [UIColor ma10Color]; 47 | break; 48 | case HYMA20Type: 49 | lineColor = [UIColor ma20Color]; 50 | break; 51 | case HYMA30Type: 52 | lineColor = [UIColor ma30Color]; 53 | break; 54 | default: 55 | break; 56 | } 57 | 58 | CGContextSetStrokeColorWithColor(self.context,lineColor.CGColor); 59 | CGContextSetLineWidth(self.context, HYStockChartMALineWidth); 60 | 61 | NSInteger count = self.MAPositions.count; 62 | CGPoint point = [self.MAPositions[0] CGPointValue]; 63 | NSAssert(!isnan(point.x) && !isnan(point.y), @"画MA线的时候出现NAN"); 64 | CGContextMoveToPoint(self.context, point.x, point.y); 65 | for (NSInteger idx = 1; idx < count; idx++) { 66 | CGPoint point = [self.MAPositions[idx] CGPointValue]; 67 | CGContextAddLineToPoint(self.context, point.x, point.y); 68 | } 69 | CGContextStrokePath(self.context); 70 | } 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/Constant 下午3.56.37/HYStockChartConstant.m: -------------------------------------------------------------------------------- 1 | // 2 | // HYConstant.m 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/4. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #ifndef __HYStockChartConstant__M__ 10 | #define __HYStockChartConstant__M__ 11 | #import 12 | 13 | /** 14 | * K线图需要加载更多数据的通知 15 | */ 16 | NSString * const HYStockChartKLineNeedLoadMoreDataNotification = @"HYStockChartKLineNeedLoadMoreDataNotification"; 17 | 18 | /** 19 | * K线图Y的View的宽度 20 | */ 21 | CGFloat const HYStockChartKLinePriceViewWidth = 50; 22 | 23 | /** 24 | * K线图的X的View的高度 25 | */ 26 | CGFloat const HYStockChartKLineTimeViewHeight = 20; 27 | 28 | /** 29 | * K线最大的宽度 30 | */ 31 | CGFloat const HYStockChartKLineMaxWidth = 27; 32 | 33 | /** 34 | * 背景框的宽度 35 | */ 36 | CGFloat const HYStockChartTimeLineGridWidth = 0.5; 37 | 38 | /** 39 | * K线图最小的宽度 40 | */ 41 | CGFloat const HYStockChartKLineMinWidth = 2; 42 | 43 | /** 44 | * K线图缩放界限 45 | */ 46 | CGFloat const HYStockChartScaleBound = 0.03; 47 | 48 | /** 49 | * K线的缩放因子 50 | */ 51 | CGFloat const HYStockChartScaleFactor = 0.03; 52 | 53 | /** 54 | * UIScrollView的contentOffset属性 55 | */ 56 | NSString * const HYStockChartContentOffsetKey = @"contentOffset"; 57 | 58 | /** 59 | * 时分线的宽度 60 | */ 61 | CGFloat const HYStockChartTimeLineLineWidth = 1.0; 62 | 63 | /** 64 | * 时分线图的Above上最小的X 65 | */ 66 | CGFloat const HYStockChartTimeLineAboveViewMinX = 0.0; 67 | 68 | /** 69 | * 分时线的timeLabelView的高度 70 | */ 71 | CGFloat const HYStockChartTimeLineTimeLabelViewHeight = 19; 72 | 73 | /** 74 | * 时分线的成交量的线宽 75 | */ 76 | CGFloat const HYStockChartTimeLineVolumeLineWidth = 2; 77 | 78 | /** 79 | * 长按时的线的宽度 80 | */ 81 | CGFloat const HYStockChartLongPressVerticalViewWidth = 0.5; 82 | 83 | /** 84 | * MA线的宽度 85 | */ 86 | CGFloat const HYStockChartMALineWidth = 1; 87 | 88 | 89 | /** 90 | * 所有profileView的高度 91 | */ 92 | CGFloat const HYStockChartProfileViewHeight = 50; 93 | 94 | 95 | #endif 96 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Model/KLineModel/JMSKLineModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // JMSKLineModel.h 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/5/7. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | * 股票类型 13 | */ 14 | typedef NS_ENUM(NSInteger, JMSStockType){ 15 | JMSStockTypeUSA = 1, //美股 16 | JMSStockTypeA, //A股 17 | JMSStockTypeHK, //港股 18 | JMSStockTypeChinaConcept, //中概股 19 | JMSStockTypeNone //没有赋值的类型 20 | }; 21 | 22 | @interface JMSKLineModel : NSObject 23 | 24 | @property(nonatomic,copy) NSString *Symbol; 25 | 26 | @property(nonatomic,copy) NSString *Currency; 27 | 28 | //股票类型 29 | @property(nonatomic,assign) JMSStockType StockType; 30 | //交易所代码 31 | @property(nonatomic,copy) NSString *ExchangeCode; 32 | 33 | @property(nonatomic,assign) CGFloat ChangeFromLastClose; 34 | 35 | @property(nonatomic,assign) CGFloat ChangeFromOpen; 36 | 37 | @property(nonatomic,assign) CGFloat CummulativeCashDividend; 38 | 39 | @property(nonatomic,assign) CGFloat CummulativeStockDividendRatio; 40 | 41 | @property(nonatomic,copy) NSString *DataConfidence; 42 | 43 | @property(nonatomic,copy) NSString *Date; 44 | 45 | /** 46 | * 最高价 47 | */ 48 | @property(nonatomic,assign) CGFloat High; 49 | 50 | /** 51 | * 收盘价 52 | */ 53 | @property(nonatomic,assign) CGFloat Last; 54 | 55 | @property(nonatomic,assign) CGFloat LastClose; 56 | 57 | /** 58 | * 最低价 59 | */ 60 | @property(nonatomic,assign) CGFloat Low; 61 | 62 | /** 63 | * 开盘价 64 | */ 65 | @property(nonatomic,assign) CGFloat Open; 66 | 67 | /** 68 | * 收盘价相对于开盘价的增减比例 69 | */ 70 | @property(nonatomic,assign) CGFloat PercentChangeFromLastClose; 71 | 72 | @property(nonatomic,assign) CGFloat PercentChangeFromOpen; 73 | 74 | /** 75 | * 成交量 76 | */ 77 | @property(nonatomic,assign) NSInteger Volume; 78 | 79 | @property(nonatomic,assign) CGFloat MA5; 80 | 81 | @property(nonatomic,assign) CGFloat MA10; 82 | 83 | @property(nonatomic,assign) CGFloat MA20; 84 | 85 | @property(nonatomic,assign) CGFloat MA30; 86 | 87 | @end 88 | -------------------------------------------------------------------------------- /RRStock/RRStock/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 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Model/MJExtension/MJConst.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __MJConst__H__ 3 | #define __MJConst__H__ 4 | 5 | #import 6 | 7 | // 过期 8 | #define MJDeprecated(instead) NS_DEPRECATED(2_0, 2_0, 2_0, 2_0, instead) 9 | 10 | #ifdef DEBUG // 调试状态 11 | // 打开LOG功能 12 | #define MJLog(...) NSLog(__VA_ARGS__) 13 | #else // 发布状态 14 | // 关闭LOG功能 15 | #define MJLog(...) 16 | #endif 17 | 18 | // 构建错误 19 | #define MJBuildError(error, msg) \ 20 | if (error) *error = [NSError errorWithDomain:msg code:250 userInfo:nil]; 21 | 22 | /** 23 | * 断言 24 | * @param condition 条件 25 | * @param returnValue 返回值 26 | */ 27 | #define MJAssertError(condition, returnValue, error, msg) \ 28 | if ((condition) == NO) { \ 29 | MJBuildError(error, msg); \ 30 | return returnValue;\ 31 | } 32 | 33 | #define MJAssert2(condition, returnValue) \ 34 | if ((condition) == NO) return returnValue; 35 | 36 | /** 37 | * 断言 38 | * @param condition 条件 39 | */ 40 | #define MJAssert(condition) MJAssert2(condition, ) 41 | 42 | /** 43 | * 断言 44 | * @param param 参数 45 | * @param returnValue 返回值 46 | */ 47 | #define MJAssertParamNotNil2(param, returnValue) \ 48 | MJAssert2((param) != nil, returnValue) 49 | 50 | /** 51 | * 断言 52 | * @param param 参数 53 | */ 54 | #define MJAssertParamNotNil(param) MJAssertParamNotNil2(param, ) 55 | 56 | /** 57 | * 打印所有的属性 58 | */ 59 | #define MJLogAllIvars \ 60 | -(NSString *)description \ 61 | { \ 62 | return [self keyValues].description; \ 63 | } 64 | 65 | /** 66 | * 类型(属性类型) 67 | */ 68 | extern NSString *const MJTypeInt; 69 | extern NSString *const MJTypeFloat; 70 | extern NSString *const MJTypeDouble; 71 | extern NSString *const MJTypeLong; 72 | extern NSString *const MJTypeLongLong; 73 | extern NSString *const MJTypeChar; 74 | extern NSString *const MJTypeBOOL; 75 | extern NSString *const MJTypePointer; 76 | 77 | extern NSString *const MJTypeIvar; 78 | extern NSString *const MJTypeMethod; 79 | extern NSString *const MJTypeBlock; 80 | extern NSString *const MJTypeClass; 81 | extern NSString *const MJTypeSEL; 82 | extern NSString *const MJTypeId; 83 | 84 | #endif -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/KLine/KLineDetailView/HYKLineDetailView.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/GloablVariable/HYStockChartGloablVariable.m: -------------------------------------------------------------------------------- 1 | // 2 | // HYStockChartGloablVariable.m 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/7. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import "HYStockChartGloablVariable.h" 10 | #import "HYStockChartConstant.h" 11 | 12 | /** 13 | * K线图的宽度,默认20 14 | */ 15 | static CGFloat HYStockChartKLineWidth = 6; 16 | 17 | /** 18 | * K线图的间隔,默认1 19 | */ 20 | static CGFloat HYStockChartKLineGap = 1; 21 | 22 | static NSString *HYStockChartStockChineseName = nil; 23 | static NSString *HYStockChartStockSymbol = nil; 24 | static HYStockType HYStockChartStockType; 25 | 26 | 27 | @implementation HYStockChartGloablVariable 28 | 29 | /** 30 | * K线图的宽度,默认20 31 | */ 32 | +(CGFloat)kLineWidth 33 | { 34 | return HYStockChartKLineWidth; 35 | } 36 | +(void)setkLineWith:(CGFloat)kLineWidth 37 | { 38 | if (kLineWidth > HYStockChartKLineMaxWidth) { 39 | kLineWidth = HYStockChartKLineMaxWidth; 40 | }else if (kLineWidth < HYStockChartKLineMinWidth){ 41 | kLineWidth = HYStockChartKLineMinWidth; 42 | } 43 | HYStockChartKLineWidth = kLineWidth; 44 | } 45 | 46 | 47 | /** 48 | * K线图的间隔,默认1 49 | */ 50 | +(CGFloat)kLineGap 51 | { 52 | return HYStockChartKLineGap; 53 | } 54 | 55 | +(void)setkLineGap:(CGFloat)kLineGap 56 | { 57 | HYStockChartKLineGap = kLineGap; 58 | } 59 | 60 | 61 | 62 | /** 63 | * 股票中文名 64 | */ 65 | +(NSString *)stockChineseName 66 | { 67 | return HYStockChartStockChineseName; 68 | } 69 | 70 | +(void)setStockChineseName:(NSString *)chineseName 71 | { 72 | HYStockChartStockChineseName = chineseName; 73 | } 74 | 75 | /** 76 | * 股票代号 77 | */ 78 | +(NSString *)stockSymbol 79 | { 80 | return HYStockChartStockSymbol; 81 | } 82 | 83 | +(void)setStockSymbol:(NSString *)symbol 84 | { 85 | HYStockChartStockSymbol = symbol; 86 | } 87 | 88 | /** 89 | * 股票类型 90 | */ 91 | +(void)setStockType:(HYStockType)stockType 92 | { 93 | HYStockChartStockType = stockType; 94 | } 95 | +(HYStockType)stockType 96 | { 97 | return HYStockChartStockType; 98 | } 99 | 100 | @end 101 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/KLine/MAView/HYKLineMAView.m: -------------------------------------------------------------------------------- 1 | // 2 | // HYKLineMAView.m 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/5/19. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import "HYKLineMAView.h" 10 | #import "UIColor+HYStockChart.h" 11 | #import "UIFont+HYStockChart.h" 12 | 13 | /************************展示各种MA的View************************/ 14 | @interface HYKLineMAView() 15 | 16 | @property (weak, nonatomic) IBOutlet UILabel *ma5Label; 17 | 18 | @property (weak, nonatomic) IBOutlet UILabel *ma10Label; 19 | 20 | @property (weak, nonatomic) IBOutlet UILabel *ma20Label; 21 | 22 | @property (weak, nonatomic) IBOutlet UILabel *ma30Label; 23 | 24 | @end 25 | 26 | @implementation HYKLineMAView 27 | 28 | #pragma mark 创建HYKLineMAView的工厂方法 29 | +(instancetype)kLineMAView 30 | { 31 | HYKLineMAView *maView = (HYKLineMAView *)[[[NSBundle mainBundle] loadNibNamed:@"HYKLineMAView" owner:nil options:nil] lastObject]; 32 | return maView; 33 | } 34 | 35 | -(void)awakeFromNib 36 | { 37 | [super awakeFromNib]; 38 | self.ma5Label.textColor = [UIColor ma5Color]; 39 | self.ma10Label.textColor = [UIColor ma10Color]; 40 | self.ma20Label.textColor = [UIColor ma20Color]; 41 | self.ma30Label.textColor = [UIColor ma30Color]; 42 | self.ma5Label.font = [UIFont f310Font]; 43 | self.ma10Label.font = [UIFont f310Font]; 44 | self.ma20Label.font = [UIFont f310Font]; 45 | self.ma30Label.font = [UIFont f310Font]; 46 | } 47 | 48 | #pragma mark - set方法 49 | #pragma mark setMaModel的方法 50 | -(void)setMaModel:(HYKLineMAModel *)maModel 51 | { 52 | _maModel = maModel; 53 | if (maModel) { 54 | self.ma5Label.text = [NSString stringWithFormat:@"MA5:%.2f",maModel.ma5Value]; 55 | self.ma10Label.text = [NSString stringWithFormat:@"MA10:%.2f",maModel.ma10Value]; 56 | self.ma20Label.text = [NSString stringWithFormat:@"MA20:%.2f",maModel.ma20Value]; 57 | self.ma30Label.text = [NSString stringWithFormat:@"MA30:%.2f",maModel.ma30Value]; 58 | } 59 | } 60 | 61 | @end 62 | 63 | /************************MAView的模型************************/ 64 | @implementation HYKLineMAModel 65 | +(instancetype)maModelWithMA5:(CGFloat)MA5 MA10:(CGFloat)MA10 MA20:(CGFloat)MA20 MA30:(CGFloat)MA30 66 | { 67 | HYKLineMAModel *model = [[HYKLineMAModel alloc] init]; 68 | model.ma5Value = MA5; 69 | model.ma10Value = MA10; 70 | model.ma20Value = MA20; 71 | model.ma30Value = MA30; 72 | return model; 73 | } 74 | @end -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Model/MJExtension/NSObject+MJProperty.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+MJProperty.h 3 | // MJExtensionExample 4 | // 5 | // Created by MJ Lee on 15/4/17. 6 | // Copyright (c) 2015年 itcast. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class MJProperty; 12 | 13 | /** 14 | * 遍历所有类的block(父类) 15 | */ 16 | typedef void (^MJClassesBlock)(Class c, BOOL *stop); 17 | 18 | /** 19 | * 遍历成员变量用的block 20 | * 21 | * @param property 成员的包装对象 22 | * @param stop YES代表停止遍历,NO代表继续遍历 23 | */ 24 | typedef void (^MJPropertiesBlock)(MJProperty *property, BOOL *stop); 25 | 26 | /** 将属性名换为其他key去字典中取值 */ 27 | typedef NSDictionary * (^ReplacedKeyFromPropertyName)(); 28 | /** 数组中需要转换的模型类 */ 29 | typedef NSDictionary * (^ObjectClassInArray)(); 30 | 31 | /** 这个数组中的属性名将会被忽略:不进行字典和模型的转换 */ 32 | typedef NSArray * (^IgnoredPropertyNames)(); 33 | /** 这个数组中的属性名将会被忽略:不进行归档 */ 34 | typedef NSArray * (^IgnoredCodingPropertyNames)(); 35 | 36 | @interface NSObject (MJProperty) 37 | 38 | /** 39 | * 遍历所有的成员 40 | */ 41 | + (void)enumeratePropertiesWithBlock:(MJPropertiesBlock)block; 42 | 43 | /** 44 | * 遍历所有的类 45 | */ 46 | + (void)enumerateClassesWithBlock:(MJClassesBlock)block; 47 | 48 | /** 49 | * 配置模型属性 50 | * 51 | * @param replacedKeyFromPropertyName 将属性名换为其他key去字典中取值 52 | * @param objectClassInArray 数组中需要转换的模型类 53 | */ 54 | + (void)setupReplacedKeyFromPropertyName:(ReplacedKeyFromPropertyName)replacedKeyFromPropertyName objectClassInArray:(ObjectClassInArray)objectClassInArray; 55 | 56 | /** 57 | * 配置模型属性 58 | * 59 | * @param replacedKeyFromPropertyName 将属性名换为其他key去字典中取值 60 | */ 61 | + (void)setupReplacedKeyFromPropertyName:(ReplacedKeyFromPropertyName)replacedKeyFromPropertyName; 62 | 63 | /** 64 | * 配置模型属性 65 | * 66 | * @param objectClassInArray 数组中需要转换的模型类 67 | */ 68 | + (void)setupObjectClassInArray:(ObjectClassInArray)objectClassInArray; 69 | 70 | /** 71 | * 配置模型属性 72 | * 73 | * @param ignoredPropertyNames 这个数组中的属性名将会被忽略:不进行字典和模型的转换 74 | */ 75 | + (void)setupIgnoredPropertyNames:(IgnoredPropertyNames)ignoredPropertyNames; 76 | 77 | /** 78 | * 这个数组中的属性名将会被忽略:不进行字典和模型的转换 79 | */ 80 | + (NSArray *)totalIgnoredPropertyNames; 81 | 82 | /** 83 | * 配置模型属性 84 | * 85 | * @param ignoredCodingPropertyNames 这个数组中的属性名将会被忽略:不进行归档 86 | */ 87 | + (void)setupIgnoredCodingPropertyNames:(IgnoredCodingPropertyNames)ignoredCodingPropertyNames; 88 | 89 | /** 90 | * 这个数组中的属性名将会被忽略:不进行归档 91 | */ 92 | + (NSArray *)totalIgnoredCodingPropertyNames; 93 | @end -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/KLine/AboveView/HYKLineAboveView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYKLineView.h 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/4. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HYKLinePositionModel.h" 11 | #import "HYKLineModel.h" 12 | 13 | @protocol HYKLineAboveViewDelegate; 14 | 15 | /************************上面的图(K线/折线)************************/ 16 | @interface HYKLineAboveView : UIView 17 | 18 | /** 19 | * 股票模型数组 20 | */ 21 | @property(nonatomic,strong) NSArray *kLineModels; 22 | 23 | /** 24 | * 父view,该父view为UIScrollView 25 | */ 26 | @property(nonatomic,weak,readonly) UIScrollView *scrollView; 27 | 28 | /** 29 | * 代理 30 | */ 31 | @property(nonatomic,weak) id delegate; 32 | 33 | /** 34 | * 画AboveView上的所有图 35 | */ 36 | -(void)drawAboveView; 37 | 38 | /** 39 | * 更新AboveView的宽度 40 | */ 41 | -(void)updateAboveViewWidth; 42 | 43 | /** 44 | * 根据指定颜色清除背景 45 | */ 46 | -(void)clearRectWithColor:(UIColor *)bgColor NS_DEPRECATED_IOS(2_0,2_0,"这个方法暂时没有实现!"); 47 | 48 | /** 49 | * 长按的时候根据原始的x的位置获得精确的X的位置 50 | */ 51 | //-(CGFloat)getRightXPositionWithOriginXPosition:(CGFloat)originXPosition; 52 | -(HYKLinePositionModel *)getRightXPositionWithOriginXPosition:(CGFloat)originXPosition; 53 | 54 | /** 55 | * 长按后展示手指按着的在数组中的位置 56 | */ 57 | -(HYKLineModel *)getRightXLocationWithOriginXPosition:(CGFloat)originXPosition; 58 | 59 | /** 60 | * 移除所有监听 61 | */ 62 | -(void)removeAllObserver; 63 | 64 | @end 65 | 66 | 67 | 68 | /************************HYKLineAboveView的代理方法************************/ 69 | @protocol HYKLineAboveViewDelegate 70 | 71 | @optional 72 | /** 73 | * 长按后展示手指按着的HYKLinePositionModel和HYKLineModel 74 | */ 75 | -(void)kLineAboveViewLongPressKLinePositionModel:(HYKLinePositionModel *)kLinePositionModel kLineModel:(HYKLineModel *)kLineModel; 76 | 77 | 78 | 79 | /** 80 | * 当前AboveView中的最大股价和最小股价 81 | */ 82 | -(void)kLineAboveViewCurrentMaxPrice:(CGFloat)maxPrice minPrice:(CGFloat)minPrice; 83 | 84 | /** 85 | * 当前需要绘制的K线模型数组 86 | */ 87 | -(void)kLineAboveViewCurrentNeedDrawKLineModels:(NSArray *)needDrawKLineModels; 88 | 89 | /** 90 | * 当前需要绘制的K线位置模型数组 91 | */ 92 | -(void)kLineAboveViewCurrentNeedDrawKLinePositionModels:(NSArray *)needDrawKLinePositionModels; 93 | 94 | /** 95 | * 当前需要绘制的K线的颜色数组 96 | */ 97 | -(void)kLineAboveViewCurrentNeedDrawKLineColors:(NSArray *)kLineColors; 98 | 99 | @end 100 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/StockChartView/StockProfileView/TimeLineLongPressProfileView/HYTimeLineLongPressView.m: -------------------------------------------------------------------------------- 1 | // 2 | // HYTimeLineLongPressView.m 3 | // RRStock 4 | // 5 | // Created by 曾文亮 on 16/12/17. 6 | // Copyright © 2016年 liang. All rights reserved. 7 | // 8 | 9 | #import "HYTimeLineLongPressView.h" 10 | #import "NSDateFormatter+HYStockChart.h" 11 | #import "HYTimeLineModel.h" 12 | #import "UIColor+HYStockChart.h" 13 | 14 | 15 | @interface HYTimeLineLongPressView () 16 | 17 | @property (weak, nonatomic) IBOutlet UILabel *timeLabel; 18 | 19 | @property (weak, nonatomic) IBOutlet UILabel *volumeLabel; 20 | 21 | @property (weak, nonatomic) IBOutlet UILabel *priceLabel; 22 | 23 | @property (weak, nonatomic) IBOutlet UILabel *appliesLabel; 24 | 25 | @end 26 | 27 | @implementation HYTimeLineLongPressView 28 | 29 | /* 30 | // Only override drawRect: if you perform custom drawing. 31 | // An empty implementation adversely affects performance during animation. 32 | - (void)drawRect:(CGRect)rect { 33 | // Drawing code 34 | } 35 | */ 36 | +(instancetype)timeLineLongPressProfileView 37 | { 38 | HYTimeLineLongPressView *timeLineLongPressProfileView = [[[NSBundle mainBundle] loadNibNamed:@"TimeLineLongPressView" owner:nil options:nil] lastObject]; 39 | return timeLineLongPressProfileView; 40 | } 41 | 42 | -(void)setTimeLineModel:(HYTimeLineModel *)timeLineModel 43 | { 44 | NSDateFormatter *formatter = [NSDateFormatter shareDateFormatter]; 45 | _timeLineModel = timeLineModel; 46 | 47 | self.priceLabel.text = [NSString stringWithFormat:@"%.2f",timeLineModel.currentPrice]; 48 | self.appliesLabel.text = [NSString stringWithFormat:@"%.2f%%",timeLineModel.PercentChangeFromPreClose]; 49 | UIColor *appliesTextColor = timeLineModel.PercentChangeFromPreClose > 0 ? [UIColor increaseColor] : [UIColor decreaseColor]; 50 | self.appliesLabel.textColor = appliesTextColor; 51 | NSString *volumeString = [NSString stringWithFormat:@"%.ld",timeLineModel.volume]; 52 | if (volumeString.length >= 9 ) { 53 | volumeString = [NSString stringWithFormat:@"%.2f亿股",timeLineModel.volume/100000000.0]; 54 | }else{ 55 | volumeString = [NSString stringWithFormat:@"%.2f万股",timeLineModel.volume/10000.0]; 56 | } 57 | self.volumeLabel.text = volumeString; 58 | formatter.dateFormat = @"MM-dd-yyyy hh:mm:ss a"; 59 | NSDate *date = [formatter dateFromString:timeLineModel.currentTime]; 60 | formatter.dateFormat = @"HH:mm"; 61 | NSString *timeStr = [formatter stringFromDate:date]; 62 | formatter.dateFormat = @"yyyy-dd-MM"; 63 | NSString *dateStr = [formatter stringFromDate:date]; 64 | self.timeLabel.text = timeStr; 65 | } 66 | 67 | 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/StockChartView/StockProfileView/BrokenLineLongPressProfileView/HYBrokenLineLongPressView.m: -------------------------------------------------------------------------------- 1 | // 2 | // HYTimeLineLongPressView.m 3 | // RRStock 4 | // 5 | // Created by 曾文亮 on 16/12/17. 6 | // Copyright © 2016年 liang. All rights reserved. 7 | // 8 | 9 | #import "HYBrokenLineLongPressView.h" 10 | #import "NSDateFormatter+HYStockChart.h" 11 | #import "HYTimeLineModel.h" 12 | #import "UIColor+HYStockChart.h" 13 | 14 | 15 | @interface HYBrokenLineLongPressView () 16 | 17 | @property (weak, nonatomic) IBOutlet UILabel *timeLabel; 18 | 19 | @property (weak, nonatomic) IBOutlet UILabel *volumeLabel; 20 | 21 | @property (weak, nonatomic) IBOutlet UILabel *priceLabel; 22 | 23 | @property (weak, nonatomic) IBOutlet UILabel *appliesLabel; 24 | 25 | @end 26 | 27 | @implementation HYBrokenLineLongPressView 28 | 29 | /* 30 | // Only override drawRect: if you perform custom drawing. 31 | // An empty implementation adversely affects performance during animation. 32 | - (void)drawRect:(CGRect)rect { 33 | // Drawing code 34 | } 35 | */ 36 | +(instancetype)brokenLineLongPressProfileView 37 | { 38 | HYBrokenLineLongPressView *timeLineLongPressProfileView = [[[NSBundle mainBundle] loadNibNamed:@"BrokenLineLongPressView" owner:nil options:nil] lastObject]; 39 | return timeLineLongPressProfileView; 40 | } 41 | 42 | -(void)setTimeLineModel:(HYTimeLineModel *)timeLineModel 43 | { 44 | NSDateFormatter *formatter = [NSDateFormatter shareDateFormatter]; 45 | _timeLineModel = timeLineModel; 46 | 47 | self.priceLabel.text = [NSString stringWithFormat:@"%.2f",timeLineModel.currentPrice]; 48 | self.appliesLabel.text = [NSString stringWithFormat:@"%.2f%%",timeLineModel.PercentChangeFromPreClose]; 49 | UIColor *appliesTextColor = timeLineModel.PercentChangeFromPreClose > 0 ? [UIColor increaseColor] : [UIColor decreaseColor]; 50 | self.appliesLabel.textColor = appliesTextColor; 51 | NSString *volumeString = [NSString stringWithFormat:@"%.ld",timeLineModel.volume]; 52 | if (volumeString.length >= 9 ) { 53 | volumeString = [NSString stringWithFormat:@"%.2f亿股",timeLineModel.volume/100000000.0]; 54 | }else{ 55 | volumeString = [NSString stringWithFormat:@"%.2f万股",timeLineModel.volume/10000.0]; 56 | } 57 | self.volumeLabel.text = volumeString; 58 | formatter.dateFormat = @"MM-dd-yyyy hh:mm:ss a"; 59 | NSDate *date = [formatter dateFromString:timeLineModel.currentTime]; 60 | formatter.dateFormat = @"HH:mm"; 61 | NSString *timeStr = [formatter stringFromDate:date]; 62 | formatter.dateFormat = @"dd-MM"; 63 | NSString *dateStr = [formatter stringFromDate:date]; 64 | self.timeLabel.text = [NSString stringWithFormat:@"%@ %@",dateStr,timeStr]; 65 | } 66 | 67 | 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/TimeLine/FiveRangeCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // FiveRangeCell.m 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 16/8/23. 6 | // Copyright © 2016年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import "FiveRangeCell.h" 10 | #import "Masonry.h" 11 | #import "CustomLabel.h" 12 | #import "UIColor+HYStockChart.h" 13 | 14 | #define WEAKSELF(weakSelf) __weak __typeof(&*self)weakSelf = self; 15 | @implementation FiveRangeCell 16 | 17 | - (void)awakeFromNib { 18 | // Initialization code 19 | } 20 | 21 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 22 | [super setSelected:selected animated:animated]; 23 | 24 | // Configure the view for the selected state 25 | } 26 | 27 | 28 | - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 29 | { 30 | if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) 31 | { 32 | [self makeView]; 33 | } 34 | return self; 35 | } 36 | 37 | - (void)makeView 38 | { 39 | 40 | CustomLabel *rangeName = [CustomLabel setCustomLabelText:@"卖5" font:10 textColor:[UIColor colorWithRed:153/255.0 green:153/255.0 blue:153/255.0 alpha:1.0]]; 41 | [self.contentView addSubview:rangeName]; 42 | WEAKSELF(weakSelf); 43 | [rangeName mas_makeConstraints:^(MASConstraintMaker *make) { 44 | make.centerY.equalTo(weakSelf.contentView); 45 | make.left.equalTo(weakSelf.contentView).offset(5); 46 | }]; 47 | 48 | 49 | CustomLabel *currentPriceLabel = [CustomLabel setCustomLabelText:@"35.56" font:10 textColor:[UIColor whiteColor153]]; 50 | currentPriceLabel.textColor = [UIColor colorWithRed:0/255.0 green:145/255.0 blue:0/255.0 alpha:1.0]; 51 | [self.contentView addSubview:currentPriceLabel]; 52 | [currentPriceLabel mas_makeConstraints:^(MASConstraintMaker *make) { 53 | make.centerY.equalTo(weakSelf.contentView); 54 | make.left.equalTo(rangeName.mas_right).offset(3); 55 | }]; 56 | 57 | 58 | CustomLabel *currentShuLiang = [CustomLabel setCustomLabelText:@"38" font:10 textColor:[UIColor whiteColor153]]; 59 | [self.contentView addSubview:currentShuLiang]; 60 | [currentShuLiang mas_makeConstraints:^(MASConstraintMaker *make) { 61 | make.centerY.equalTo(weakSelf.contentView); 62 | make.left.equalTo(currentPriceLabel.mas_right).offset(10); 63 | }]; 64 | 65 | CustomLabel *currentStyleLabel = [CustomLabel setCustomLabelText:@"B" font:10 textColor:[UIColor whiteColor153]]; 66 | [self.contentView addSubview:currentStyleLabel]; 67 | [currentStyleLabel mas_makeConstraints:^(MASConstraintMaker *make) { 68 | make.centerY.equalTo(weakSelf.contentView); 69 | make.left.equalTo(currentShuLiang.mas_right).offset(3); 70 | }]; 71 | 72 | } 73 | 74 | 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/TimeLine/TradeDetailCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // TradeDetailCell.m 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 16/8/23. 6 | // Copyright © 2016年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import "TradeDetailCell.h" 10 | #import "Masonry.h" 11 | #import "CustomLabel.h" 12 | #import "UIColor+HYStockChart.h" 13 | 14 | #define WEAKSELF(weakSelf) __weak __typeof(&*self)weakSelf = self; 15 | 16 | @implementation TradeDetailCell 17 | 18 | - (void)awakeFromNib { 19 | // Initialization code 20 | } 21 | 22 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 23 | [super setSelected:selected animated:animated]; 24 | 25 | // Configure the view for the selected state 26 | } 27 | 28 | 29 | - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 30 | { 31 | if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) 32 | { 33 | [self makeView]; 34 | } 35 | return self; 36 | } 37 | 38 | - (void)makeView 39 | { 40 | 41 | CustomLabel *currentTimeLabel = [CustomLabel setCustomLabelText:@"14.56" font:10 textColor:[UIColor whiteColor153]]; 42 | [self.contentView addSubview:currentTimeLabel]; 43 | WEAKSELF(weakSelf); 44 | [currentTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) { 45 | make.centerY.equalTo(weakSelf.contentView); 46 | make.left.equalTo(weakSelf.contentView).offset(5); 47 | }]; 48 | 49 | 50 | CustomLabel *currentPriceLabel = [CustomLabel setCustomLabelText:@"35.56" font:10 textColor:[UIColor whiteColor153]]; 51 | currentPriceLabel.textColor = [UIColor colorWithRed:0/255.0 green:145/255.0 blue:0/255.0 alpha:1.0]; 52 | [self.contentView addSubview:currentPriceLabel]; 53 | [currentPriceLabel mas_makeConstraints:^(MASConstraintMaker *make) { 54 | make.centerY.equalTo(weakSelf.contentView); 55 | make.left.equalTo(currentTimeLabel.mas_right).offset(3); 56 | }]; 57 | 58 | 59 | CustomLabel *currentShuLiang = [CustomLabel setCustomLabelText:@"38" font:10 textColor:[UIColor whiteColor153]]; 60 | [self.contentView addSubview:currentShuLiang]; 61 | [currentShuLiang mas_makeConstraints:^(MASConstraintMaker *make) { 62 | make.centerY.equalTo(weakSelf.contentView); 63 | make.left.equalTo(currentPriceLabel.mas_right).offset(10); 64 | }]; 65 | 66 | CustomLabel *currentStyleLabel = [CustomLabel setCustomLabelText:@"B" font:10 textColor:[UIColor whiteColor153]]; 67 | [self.contentView addSubview:currentStyleLabel]; 68 | [currentStyleLabel mas_makeConstraints:^(MASConstraintMaker *make) { 69 | make.centerY.equalTo(weakSelf.contentView); 70 | make.left.equalTo(currentShuLiang.mas_right).offset(3); 71 | }]; 72 | 73 | 74 | } 75 | 76 | 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/StockContentView.m: -------------------------------------------------------------------------------- 1 | // 2 | // StockContentView.m 3 | // RRCP 4 | // 5 | // Created by 人人操盘 on 16/8/23. 6 | // Copyright © 2016年 renrencaopan. All rights reserved. 7 | // 8 | 9 | #import "StockContentView.h" 10 | #import "StockChartTitleView.h" 11 | #import "UIColor+Utils.h" 12 | 13 | #define tabTitleViewHeight 44 14 | @interface StockContentView () 15 | 16 | @property (nonatomic, strong) StockChartTitleView *tabTitleView; 17 | 18 | @property (nonatomic, strong) UIScrollView *tabContentView; 19 | 20 | @end 21 | 22 | @implementation StockContentView 23 | 24 | -(instancetype)initWithTabConfigArray:(NSArray *)tabConfigArray { 25 | self = [super initWithFrame:CGRectZero]; 26 | if (self) { 27 | self.frame = CGRectMake(0, 0, ScreenW, ScreenH); 28 | 29 | NSArray *titleArray = @[@"观点",@"新闻",@"公告",@"研报",@"资料",@"交易"]; 30 | _tabTitleView = [[StockChartTitleView alloc] initWithTitleArray:titleArray]; 31 | 32 | __weak typeof(self) weakSelf = self; 33 | _tabTitleView.titleClickBlock = ^(NSInteger row){ 34 | if (weakSelf.tabContentView) { 35 | weakSelf.tabContentView.contentOffset = CGPointMake(ScreenW*row, 0); 36 | } 37 | }; 38 | 39 | [self addSubview:_tabTitleView]; 40 | 41 | 42 | 43 | _tabContentView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, tabTitleViewHeight, ScreenW, CGRectGetHeight(self.frame)- tabTitleViewHeight)]; 44 | _tabContentView.contentSize = CGSizeMake(CGRectGetWidth(_tabContentView.frame)* titleArray.count, CGRectGetHeight(_tabContentView.frame)); 45 | _tabContentView.pagingEnabled = YES; 46 | _tabContentView.bounces = NO; 47 | _tabContentView.showsHorizontalScrollIndicator = NO; 48 | _tabContentView.delegate = self; 49 | [self addSubview:_tabContentView]; 50 | for (int i=0; i 14 | 15 | @end 16 | 17 | #define FiveRangeCellIdentifer @"FiveRangeCellIdentifer" 18 | @implementation FiveRangeTableView 19 | 20 | /* 21 | // Only override drawRect: if you perform custom drawing. 22 | // An empty implementation adversely affects performance during animation. 23 | - (void)drawRect:(CGRect)rect { 24 | // Drawing code 25 | } 26 | */ 27 | 28 | - (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style 29 | { 30 | self = [super initWithFrame:frame style:style]; 31 | if (self) { 32 | 33 | self.dataSource = self; 34 | self.delegate = self; 35 | 36 | self.separatorStyle = UITableViewCellSeparatorStyleNone; 37 | [self registerClass:[FiveRangeCell class] forCellReuseIdentifier:FiveRangeCellIdentifer]; 38 | } 39 | return self; 40 | } 41 | 42 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 43 | { 44 | 45 | return 2; 46 | } 47 | 48 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 49 | { 50 | 51 | return 5; 52 | 53 | } 54 | 55 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 56 | { 57 | FiveRangeCell *cell = [tableView dequeueReusableCellWithIdentifier:FiveRangeCellIdentifer]; 58 | return cell; 59 | 60 | 61 | } 62 | 63 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 64 | { 65 | 66 | return (self.frame.size.height - 20)/ 10; 67 | } 68 | 69 | - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section 70 | { 71 | 72 | UIView *sectionView = [[UIView alloc]init]; 73 | sectionView.backgroundColor = [UIColor whiteColor]; 74 | UIView *lineView = [[UIView alloc]init]; 75 | [sectionView addSubview:lineView]; 76 | lineView.backgroundColor = [UIColor colorWithRed:224/255.0 green:224/255.0 blue:224/255.0 alpha:1.0]; 77 | [lineView mas_makeConstraints:^(MASConstraintMaker *make) { 78 | make.width.equalTo(sectionView); 79 | make.centerY.equalTo(sectionView); 80 | make.left.equalTo(sectionView); 81 | make.height.mas_equalTo(@0.5); 82 | }]; 83 | 84 | return sectionView; 85 | } 86 | 87 | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section 88 | { 89 | 90 | if (section == 0) 91 | { 92 | return 20.0f; 93 | } 94 | else 95 | { 96 | return 0.001f; 97 | } 98 | 99 | } 100 | 101 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section 102 | { 103 | 104 | return 0.01f; 105 | } 106 | 107 | 108 | 109 | @end 110 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/Category/UIColor+HYStockChart/UIColor+HYStockChart.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor+HYStockChartExtension.m 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/5/25. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import "UIColor+HYStockChart.h" 10 | 11 | @implementation UIColor (HYStockChart) 12 | 13 | + (UIColor *)colorWithRGBHex:(UInt32)hex { 14 | int r = (hex >> 16) & 0xFF; 15 | int g = (hex >> 8) & 0xFF; 16 | int b = (hex) & 0xFF; 17 | 18 | return [UIColor colorWithRed:r / 255.0f 19 | green:g / 255.0f 20 | blue:b / 255.0f 21 | alpha:1.0f]; 22 | } 23 | 24 | #pragma mark 所有图表的背景颜色 25 | +(UIColor *)backgroundColor 26 | { 27 | //return [UIColor colorWithRGBHex:0x181c20]; 28 | return [UIColor whiteColor]; 29 | } 30 | 31 | #pragma mark 辅助背景色 32 | +(UIColor *)assistBackgroundColor 33 | { 34 | //return [UIColor colorWithRGBHex:0x1d2227]; 35 | return [UIColor whiteColor]; 36 | } 37 | 38 | #pragma mark 涨的颜色 39 | +(UIColor *)increaseColor 40 | { 41 | return [UIColor colorWithRed:206/255.0 green:65/255.0 blue:51/255.0 alpha:1.0]; 42 | } 43 | 44 | #pragma mark 153颜色 45 | +(UIColor *)whiteColor153 46 | { 47 | return [UIColor colorWithRGBHex:0x999999]; 48 | } 49 | 50 | #pragma mark 跌的颜色 51 | +(UIColor *)decreaseColor 52 | { 53 | return [UIColor colorWithRed:37/255.0 green:174/255.0 blue:68/255.0 alpha:1.0];; 54 | } 55 | 56 | #pragma mark 主文字颜色 57 | +(UIColor *)mainTextColor 58 | { 59 | return [UIColor colorWithRGBHex:0xe1e2e6]; 60 | } 61 | 62 | #pragma mark 辅助文字颜色 63 | +(UIColor *)assistTextColor 64 | { 65 | return [UIColor colorWithRGBHex:0x565a64]; 66 | } 67 | 68 | #pragma mark 分时线下面的成交量线的颜色 69 | +(UIColor *)timeLineVolumeLineColor 70 | { 71 | return [UIColor colorWithRGBHex:0x2d333a]; 72 | } 73 | 74 | #pragma mark 分时线界面线的颜色 75 | +(UIColor *)timeLineLineColor 76 | { 77 | // return [UIColor colorWithRGBHex:0x49a5ff]; 78 | return [UIColor colorWithRGBHex:0x1860FE]; 79 | } 80 | 81 | #pragma mark 长按时线的颜色 82 | +(UIColor *)longPressLineColor 83 | { 84 | //return [UIColor colorWithRGBHex:0xff5353]; 85 | return [UIColor colorWithRGBHex:0x666666]; 86 | } 87 | 88 | #pragma mark 边框线的颜色 89 | +(UIColor *)gridLineColor 90 | { 91 | //return [UIColor colorWithRGBHex:0xff5353]; 92 | return [UIColor colorWithRGBHex:0x999999]; 93 | } 94 | 95 | #pragma mark ma5的颜色 96 | +(UIColor *)ma5Color 97 | { 98 | return [UIColor colorWithRGBHex:0xff783c]; 99 | } 100 | 101 | #pragma mark ma10的颜色 102 | +(UIColor *)ma10Color 103 | { 104 | return [UIColor colorWithRGBHex:0x49a5ff]; 105 | } 106 | 107 | #pragma mark ma20颜色 108 | +(UIColor *)ma20Color 109 | { 110 | return [UIColor colorWithRGBHex:0xffbf43]; 111 | } 112 | 113 | #pragma mark ma30颜色 114 | +(UIColor *)ma30Color 115 | { 116 | return [UIColor colorWithRGBHex:0x49a5ff]; 117 | } 118 | 119 | #pragma mark 分时图渐变色 120 | +(UIColor *)fenShiGradientColor 121 | { 122 | return [UIColor colorWithRGBHex:0x1860FE]; 123 | } 124 | @end 125 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/StockChartView/StockProfileView/KLineLongPressProfileView/HYKLineLongPressView.m: -------------------------------------------------------------------------------- 1 | // 2 | // HYKLineLongPressView.m 3 | // RRStock 4 | // 5 | // Created by 曾文亮 on 16/12/17. 6 | // Copyright © 2016年 liang. All rights reserved. 7 | // 8 | 9 | #import "HYKLineLongPressView.h" 10 | #import "HYKLineModel.h" 11 | #import "HYStockChartGloablVariable.h" 12 | #import "UIColor+HYStockChart.h" 13 | #import "HYStockChartTool.h" 14 | #import "NSDateFormatter+HYStockChart.h" 15 | 16 | @interface HYKLineLongPressView () 17 | 18 | @property (weak, nonatomic) IBOutlet UILabel *appliesLabel; 19 | 20 | @property (weak, nonatomic) IBOutlet UILabel *closePriceLabel; 21 | 22 | @property (weak, nonatomic) IBOutlet UILabel *openPriceLabel; 23 | 24 | @property (weak, nonatomic) IBOutlet UILabel *maxPriceLabel; 25 | 26 | @property (weak, nonatomic) IBOutlet UILabel *minPriceLabel; 27 | 28 | @property (weak, nonatomic) IBOutlet UILabel *timeLabel; 29 | 30 | @property (weak, nonatomic) IBOutlet UILabel *volumeLabel; 31 | 32 | @end 33 | 34 | @implementation HYKLineLongPressView 35 | 36 | /* 37 | // Only override drawRect: if you perform custom drawing. 38 | // An empty implementation adversely affects performance during animation. 39 | - (void)drawRect:(CGRect)rect { 40 | // Drawing code 41 | } 42 | */ 43 | 44 | +(instancetype)kLineLongPressProfileView 45 | { 46 | HYKLineLongPressView *longPressProfileView = [[[NSBundle mainBundle] loadNibNamed:@"kLineLongPressView" owner:nil options:nil] lastObject]; 47 | 48 | // longPressProfileView.symbolLabel.text = [HYStockChartGloablVariable stockSymbol]; 49 | return longPressProfileView; 50 | } 51 | 52 | #pragma mark - set方法 53 | -(void)setKLineModel:(HYKLineModel *)kLineModel 54 | { 55 | _kLineModel = kLineModel; 56 | 57 | NSString *currencySymbol = [HYStockChartTool currencySymbol]; 58 | self.closePriceLabel.text = [NSString stringWithFormat:@"%.2f",kLineModel.close]; 59 | self.appliesLabel.text = [NSString stringWithFormat:@"%.2f%%",kLineModel.percentChangeFromOpen]; 60 | UIColor *appliesLabelColor = kLineModel.percentChangeFromOpen > 0 ? [UIColor increaseColor] : [UIColor decreaseColor]; 61 | self.appliesLabel.textColor = appliesLabelColor; 62 | self.openPriceLabel.text = [NSString stringWithFormat:@"%.2f",kLineModel.open]; 63 | self.maxPriceLabel.text = [NSString stringWithFormat:@"%.2f",kLineModel.high]; 64 | self.minPriceLabel.text = [NSString stringWithFormat:@"%.2f",kLineModel.low]; 65 | 66 | NSDateFormatter *formatter = [NSDateFormatter shareDateFormatter]; 67 | 68 | formatter.dateFormat = @"MM-dd-yyyy"; 69 | NSDate *date = [formatter dateFromString:kLineModel.date]; 70 | formatter.dateFormat = @"yyyy-MM-dd"; 71 | NSString *dateStr = [formatter stringFromDate:date]; 72 | self.timeLabel.text = [NSString stringWithFormat:@"%@",dateStr]; 73 | 74 | NSString *volumeString = [NSString stringWithFormat:@"%f",kLineModel.volume]; 75 | if (volumeString.length >= 9 ) { 76 | volumeString = [NSString stringWithFormat:@"%.2f亿股",kLineModel.volume/100000000.0]; 77 | }else{ 78 | volumeString = [NSString stringWithFormat:@"%.2f万股",kLineModel.volume/10000.0]; 79 | } 80 | self.volumeLabel.text = volumeString; 81 | } 82 | 83 | 84 | @end 85 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/TimeLine/BelowView/YYTimeLineBelowMaskView.m: -------------------------------------------------------------------------------- 1 | // 2 | // YYTimeLineBelowMaskView.m 3 | // RRStock 4 | // 5 | // Created by 曾文亮 on 16/12/17. 6 | // Copyright © 2016年 liang. All rights reserved. 7 | // 8 | 9 | #import "YYTimeLineBelowMaskView.h" 10 | 11 | @implementation YYTimeLineBelowMaskView 12 | 13 | /* 14 | // Only override drawRect: if you perform custom drawing. 15 | // An empty implementation adversely affects performance during animation. 16 | - (void)drawRect:(CGRect)rect { 17 | // Drawing code 18 | } 19 | */ 20 | 21 | - (void)drawRect:(CGRect)rect { 22 | [super drawRect:rect]; 23 | [self drawDashLine]; 24 | } 25 | 26 | /** 27 | 绘制长按的背景线 28 | */ 29 | - (void)drawDashLine { 30 | 31 | CGContextRef ctx = UIGraphicsGetCurrentContext(); 32 | 33 | CGFloat lengths[] = {3,3}; 34 | CGContextSetLineDash(ctx, 0, lengths, 2); 35 | CGContextSetStrokeColorWithColor(ctx, [UIColor colorWithWhite102].CGColor); 36 | CGContextSetLineWidth(ctx, 0.5); 37 | 38 | //CGFloat x = self.timeLineView.frame.origin.x + self.selectedPoint.x - self.stockScrollView.contentOffset.x; 39 | 40 | //绘制横线 41 | CGContextMoveToPoint(ctx, HYStockChartTimeLineAboveViewMinX, self.selectedPoint.y); 42 | CGContextAddLineToPoint(ctx, HYStockChartTimeLineAboveViewMinX + self.frame.size.width, self.selectedPoint.y); 43 | 44 | //绘制竖线 45 | CGContextMoveToPoint(ctx, self.selectedPoint.x, self.frame.origin.y); 46 | CGContextAddLineToPoint(ctx, self.selectedPoint.x, self.frame.size.height); 47 | CGContextStrokePath(ctx); 48 | 49 | 50 | //绘制交叉圆点 51 | // CGContextSetStrokeColorWithColor(ctx, [UIColor colorWithWhite102].CGColor); 52 | // CGContextSetFillColorWithColor(ctx, [UIColor whiteColor].CGColor); 53 | // CGContextSetLineWidth(ctx, 1.5); 54 | // CGContextSetLineDash(ctx, 0, NULL, 0); 55 | // CGContextAddArc(ctx, self.selectedPoint.x, self.selectedPoint.y, 3.0, 0, 2 * M_PI, 0); 56 | // CGContextDrawPath(ctx, kCGPathFillStroke); 57 | 58 | //绘制选中日期 59 | NSDictionary *attribute = @{NSFontAttributeName:[UIFont systemFontOfSize:9],NSForegroundColorAttributeName:[UIColor colorWithWhite153]}; 60 | //绘制选中价格 61 | NSString *priceText = [NSString stringWithFormat:@"%zd",[self.selectedModel volume] ]; 62 | CGRect priceRect = [self rectOfNSString:priceText attribute:attribute]; 63 | CGContextSetFillColorWithColor(ctx, [UIColor whiteColor].CGColor); 64 | // CGContextFillRect(ctx, CGRectMake(HYStockChartTimeLineAboveViewMaxX - priceRect.size.width - 4, self.selectedPoint.y - priceRect.size.height/2.f - 2, priceRect.size.width + 4, priceRect.size.height + 4)); 65 | [priceText drawInRect:CGRectMake( 2, 2, priceRect.size.width, priceRect.size.height) withAttributes:attribute]; 66 | 67 | } 68 | 69 | - (CGRect)rectOfNSString:(NSString *)string attribute:(NSDictionary *)attribute { 70 | CGRect rect = [string boundingRectWithSize:CGSizeMake(MAXFLOAT, 0) 71 | options:NSStringDrawingTruncatesLastVisibleLine |NSStringDrawingUsesLineFragmentOrigin | 72 | NSStringDrawingUsesFontLeading 73 | attributes:attribute 74 | context:nil]; 75 | return rect; 76 | } 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/KLine/BelowView/HYKLineVolume.m: -------------------------------------------------------------------------------- 1 | // 2 | // HYKLineVolume.m 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/8. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import "HYKLineVolume.h" 10 | #import "HYStockChartGloablVariable.h" 11 | #import "UIFont+HYStockChart.h" 12 | #import "UIColor+HYStockChart.h" 13 | #import "HYStockChartConstant.h" 14 | #import "HYStockChartGloablVariable.h" 15 | 16 | @interface HYKLineVolume() 17 | 18 | @property(nonatomic,assign) CGContextRef context; 19 | 20 | @property(nonatomic,assign) CGPoint lastDrawDatePoint; 21 | 22 | @end 23 | 24 | @implementation HYKLineVolume 25 | 26 | #pragma mark 根据context初始化模型 27 | -(instancetype)initWithContext:(CGContextRef)context 28 | { 29 | self = [super init]; 30 | if (self) { 31 | _context = context; 32 | } 33 | return self; 34 | } 35 | 36 | #pragma mark 绘图方法 37 | -(void)draw 38 | { 39 | if (!self.kLineModel || !self.positionModel || !self.context || !self.lineColor) { 40 | return; 41 | } 42 | CGContextRef context = self.context; 43 | 44 | if (self.kLineModel.isFirstTradeDate) { 45 | 46 | NSString *dateStr = self.kLineModel.date; 47 | NSDateFormatter *formatter = [NSDateFormatter new]; 48 | formatter.dateFormat = @"MM/dd/yyyy"; 49 | NSDate *date = [formatter dateFromString:dateStr]; 50 | formatter.dateFormat = @"yyyy-MM-dd"; 51 | dateStr = [formatter stringFromDate:date]; 52 | CGSize dateSize = [dateStr sizeWithAttributes:@{NSFontAttributeName:[UIFont f39Font]}]; 53 | CGPoint drawDatePoint = CGPointMake(self.positionModel.startPoint.x-dateSize.width/2, 0); 54 | 55 | if (CGPointEqualToPoint(self.lastDrawDatePoint, CGPointZero) || drawDatePoint.x - self.lastDrawDatePoint.x > 100) { 56 | 57 | self.lastDrawDatePoint = drawDatePoint; 58 | 59 | CGPoint startPoint = CGPointMake(self.positionModel.startPoint.x, 0); 60 | CGPoint endPoint = CGPointMake(self.positionModel.startPoint.x, self.positionModel.endPoint.y); 61 | [self drawline:context startPoint:startPoint stopPoint:endPoint color:[UIColor gridLineColor] lineWidth:0.25]; 62 | } 63 | 64 | 65 | 66 | 67 | } 68 | 69 | 70 | 71 | 72 | 73 | CGContextSetStrokeColorWithColor(context, self.lineColor.CGColor); 74 | //设置线的宽度 75 | CGContextSetLineWidth(context, [HYStockChartGloablVariable kLineWidth]); 76 | //画实体线 77 | const CGPoint solidPoints[] = {self.positionModel.startPoint,self.positionModel.endPoint}; 78 | CGContextStrokeLineSegments(context, solidPoints, 2); 79 | } 80 | 81 | #pragma mark - **************** 绘制线 82 | - (void)drawline:(CGContextRef)context 83 | startPoint:(CGPoint)startPoint 84 | stopPoint:(CGPoint)stopPoint 85 | color:(UIColor *)color 86 | lineWidth:(CGFloat)lineWitdth 87 | { 88 | CGContextSetStrokeColorWithColor(context, color.CGColor); 89 | CGContextSetLineWidth(context, lineWitdth); 90 | CGContextBeginPath(context); 91 | CGContextMoveToPoint(context, startPoint.x, startPoint.y); 92 | CGContextAddLineToPoint(context, stopPoint.x,stopPoint.y); 93 | CGContextStrokePath(context); 94 | } 95 | 96 | 97 | @end 98 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/StockChartView/StockProfileView/KLineLongPressProfileView/HYKLineLongPressProfileView.m: -------------------------------------------------------------------------------- 1 | // 2 | // HYKLineLongPressProfileView.m 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/6/8. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import "HYKLineLongPressProfileView.h" 10 | #import "HYKLineModel.h" 11 | #import "HYStockChartGloablVariable.h" 12 | #import "UIColor+HYStockChart.h" 13 | #import "HYStockChartTool.h" 14 | 15 | @interface HYKLineLongPressProfileView () 16 | 17 | @property (weak, nonatomic) IBOutlet UILabel *chineseNameLabel; 18 | 19 | @property (weak, nonatomic) IBOutlet UILabel *symbolLabel; 20 | 21 | @property (weak, nonatomic) IBOutlet UILabel *closePriceLabel; 22 | 23 | @property (weak, nonatomic) IBOutlet UILabel *appliesLabel; 24 | 25 | @property (weak, nonatomic) IBOutlet UILabel *openPriceLabel; 26 | 27 | @property (weak, nonatomic) IBOutlet UILabel *openPriceNameLabel; 28 | 29 | @property (weak, nonatomic) IBOutlet UILabel *maxPriceLabel; 30 | 31 | @property (weak, nonatomic) IBOutlet UILabel *maxPriceNameLabel; 32 | 33 | @property (weak, nonatomic) IBOutlet UILabel *minPriceLabel; 34 | 35 | @property (weak, nonatomic) IBOutlet UILabel *minPriceNameLabel; 36 | 37 | @end 38 | 39 | @implementation HYKLineLongPressProfileView 40 | 41 | +(instancetype)kLineLongPressProfileView 42 | { 43 | HYKLineLongPressProfileView *longPressProfileView = [[[NSBundle mainBundle] loadNibNamed:@"HYKLineLongPressProfileView" owner:nil options:nil] lastObject]; 44 | longPressProfileView.chineseNameLabel.text = [HYStockChartGloablVariable stockChineseName]; 45 | // longPressProfileView.symbolLabel.text = [HYStockChartGloablVariable stockSymbol]; 46 | longPressProfileView.symbolLabel.text = @"APPL"; 47 | return longPressProfileView; 48 | } 49 | 50 | -(void)awakeFromNib 51 | { 52 | [super awakeFromNib]; 53 | self.backgroundColor = [UIColor assistBackgroundColor]; 54 | self.symbolLabel.textColor = [UIColor assistTextColor]; 55 | self.chineseNameLabel.textColor = [UIColor mainTextColor]; 56 | self.closePriceLabel.textColor = [UIColor mainTextColor]; 57 | self.appliesLabel.textColor = [UIColor increaseColor]; 58 | self.openPriceLabel.textColor = [UIColor mainTextColor]; 59 | self.openPriceNameLabel.textColor = [UIColor assistTextColor]; 60 | self.maxPriceLabel.textColor = [UIColor mainTextColor]; 61 | self.maxPriceNameLabel.textColor = [UIColor assistTextColor]; 62 | self.minPriceLabel.textColor = [UIColor mainTextColor]; 63 | self.minPriceNameLabel.textColor = [UIColor assistTextColor]; 64 | } 65 | 66 | #pragma mark - set方法 67 | -(void)setKLineModel:(HYKLineModel *)kLineModel 68 | { 69 | _kLineModel = kLineModel; 70 | 71 | NSString *currencySymbol = [HYStockChartTool currencySymbol]; 72 | self.closePriceLabel.text = [NSString stringWithFormat:@"%.2f",kLineModel.close]; 73 | self.appliesLabel.text = [NSString stringWithFormat:@"%.2f%%",kLineModel.percentChangeFromOpen]; 74 | UIColor *appliesLabelColor = kLineModel.percentChangeFromOpen > 0 ? [UIColor increaseColor] : [UIColor decreaseColor]; 75 | self.appliesLabel.textColor = appliesLabelColor; 76 | self.openPriceLabel.text = [NSString stringWithFormat:@"%.2f",kLineModel.open]; 77 | self.maxPriceLabel.text = [NSString stringWithFormat:@"%.2f",kLineModel.high]; 78 | self.minPriceLabel.text = [NSString stringWithFormat:@"%.2f",kLineModel.low]; 79 | } 80 | 81 | 82 | @end 83 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/StockChartView/StockProfileView/DefaultProfileView/HYStoctDefaultProfileView.m: -------------------------------------------------------------------------------- 1 | // 2 | // HYStockChartProfileView.m 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/14. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import "HYStoctDefaultProfileView.h" 10 | #import "UIColor+HYStockChart.h" 11 | #import "HYStockChartProfileModel.h" 12 | #import "HYStockChartGloablVariable.h" 13 | #import "HYStockChartTool.h" 14 | 15 | @interface HYStoctDefaultProfileView () 16 | 17 | @property (weak, nonatomic) IBOutlet UILabel *chineseNameLabel; 18 | @property (weak, nonatomic) IBOutlet UILabel *symbolLabel; 19 | @property (weak, nonatomic) IBOutlet UILabel *currentPriceLabel; 20 | @property (weak, nonatomic) IBOutlet UILabel *volumeLabel; 21 | @property (weak, nonatomic) IBOutlet UILabel *updateTimeLabel; 22 | @property (weak, nonatomic) IBOutlet UILabel *updateDateLabel; 23 | @property (weak, nonatomic) IBOutlet UILabel *appliesLabel; 24 | 25 | 26 | @property (weak, nonatomic) IBOutlet UILabel *volumeNameLabel; 27 | 28 | 29 | @end 30 | 31 | @implementation HYStoctDefaultProfileView 32 | 33 | +(HYStoctDefaultProfileView *)profileView 34 | { 35 | HYStoctDefaultProfileView *profileView = [[[NSBundle mainBundle] loadNibNamed:@"defaultLineLongPressView" owner:nil options:nil] lastObject]; 36 | return profileView; 37 | } 38 | 39 | -(void)awakeFromNib 40 | { 41 | [super awakeFromNib]; 42 | self.backgroundColor = [UIColor assistBackgroundColor]; 43 | self.chineseNameLabel.textColor = [UIColor mainTextColor]; 44 | self.currentPriceLabel.textColor = [UIColor mainTextColor]; 45 | self.volumeLabel.textColor = [UIColor mainTextColor]; 46 | self.updateTimeLabel.textColor = [UIColor mainTextColor]; 47 | 48 | self.symbolLabel.textColor = [UIColor assistTextColor]; 49 | self.appliesLabel.textColor = [UIColor assistTextColor]; 50 | self.volumeNameLabel.textColor = [UIColor assistTextColor]; 51 | self.updateDateLabel.textColor = [UIColor assistTextColor]; 52 | } 53 | 54 | -(void)setProfileModel:(HYStockChartProfileModel *)profileModel 55 | { 56 | _profileModel = profileModel; 57 | self.chineseNameLabel.text = [HYStockChartGloablVariable stockChineseName]; 58 | self.symbolLabel.text = [HYStockChartGloablVariable stockSymbol]; 59 | NSString *currencySymbol = [HYStockChartTool currencySymbol]; 60 | self.currentPriceLabel.text = [NSString stringWithFormat:@"%@%.2f",currencySymbol,profileModel.CurrentPrice]; 61 | NSString *volumeString = [NSString stringWithFormat:@"%.f",profileModel.Volume]; 62 | if (volumeString.length >= 9 ) { 63 | volumeString = [NSString stringWithFormat:@"%.2f亿股",profileModel.Volume/100000000.0]; 64 | }else{ 65 | volumeString = [NSString stringWithFormat:@"%.2f万股",profileModel.Volume/10000.0]; 66 | } 67 | self.volumeLabel.text = volumeString; 68 | self.appliesLabel.text = [NSString stringWithFormat:@"%.2f%%",profileModel.applies]; 69 | UIColor *appliesTextColor = profileModel.applies > 0 ? [UIColor increaseColor] : [UIColor decreaseColor]; 70 | self.appliesLabel.textColor = appliesTextColor; 71 | NSDateFormatter *formatter = [NSDateFormatter new]; 72 | formatter.dateFormat = @"HH:mm"; 73 | self.updateTimeLabel.text = [formatter stringFromDate:[NSDate date]]; 74 | formatter.dateFormat = @"yyyy-MM-dd"; 75 | self.updateDateLabel.text = [formatter stringFromDate:[NSDate date]]; 76 | } 77 | 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/Constant 下午3.56.37/HYStockChartConstant.h: -------------------------------------------------------------------------------- 1 | // 2 | // HYConstant.h 3 | // JimuStockChartDemo 4 | // 5 | // Created by jimubox on 15/5/4. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #ifndef __HYStockChartConstant__H__ 10 | #define __HYStockChartConstant__H__ 11 | #import 12 | 13 | /** 14 | * K线图需要加载更多数据的通知 15 | */ 16 | extern NSString * const HYStockChartKLineNeedLoadMoreDataNotification; 17 | 18 | /** 19 | * K线图Price的View的宽度 20 | */ 21 | extern CGFloat const HYStockChartKLinePriceViewWidth; 22 | 23 | /** 24 | * K线图的Time的View的高度 25 | */ 26 | extern CGFloat const HYStockChartKLineTimeViewHeight; 27 | 28 | /** 29 | * K线最大的宽度 30 | */ 31 | extern CGFloat const HYStockChartKLineMaxWidth; 32 | 33 | /** 34 | * K线图最小的宽度 35 | */ 36 | extern CGFloat const HYStockChartKLineMinWidth; 37 | 38 | /** 39 | * 背景框的宽度 40 | */ 41 | extern CGFloat const HYStockChartTimeLineGridWidth ; 42 | 43 | /** 44 | * UIScrollView的contentOffset属性 45 | */ 46 | extern NSString * const HYStockChartContentOffsetKey; 47 | 48 | /** 49 | * K线图缩放界限 50 | */ 51 | extern CGFloat const HYStockChartScaleBound; 52 | 53 | /** 54 | * K线的缩放因子 55 | */ 56 | extern CGFloat const HYStockChartScaleFactor; 57 | 58 | /** 59 | * K线图上可画区域最小的Y 60 | */ 61 | #define HYStockChartKLineAboveViewMinY 20 62 | 63 | /** 64 | * K线图上可画区域最大的Y 65 | */ 66 | #define HYStockChartKLineAboveViewMaxY (self.frame.size.height-20) 67 | 68 | /** 69 | * K线图的成交量上最小的Y 70 | */ 71 | #define HYStockChartKLineBelowViewMinY 5 72 | 73 | /** 74 | * K线图的成交量最大的Y 75 | */ 76 | #define HYStockChartKLineBelowViewMaxY (self.frame.size.height) 77 | 78 | 79 | /** 80 | * 时分线图的Above上最小的Y 81 | */ 82 | #define HYStockChartTimeLineAboveViewMinY 10 83 | 84 | /** 85 | * 时分线图的Above上最大的Y 86 | */ 87 | #define HYStockChartTimeLineAboveViewMaxY (self.frame.size.height-HYStockChartTimeLineTimeLabelViewHeight) 88 | 89 | /** 90 | * 时分线图的Above上最小的X 91 | */ 92 | extern CGFloat const HYStockChartTimeLineAboveViewMinX; 93 | 94 | /** 95 | * 时分线的宽度 96 | */ 97 | extern CGFloat const HYStockChartTimeLineLineWidth; 98 | 99 | /** 100 | * 时分线图的Above上最大的Y 101 | */ 102 | #define HYStockChartTimeLineAboveViewMaxX (self.frame.size.width ) 103 | 104 | /** 105 | * 时分线图的Below上最小的Y 106 | */ 107 | #define HYStockChartTimeLineBelowViewMinY 0 108 | 109 | /** 110 | * 时分线图的Below上最大的Y 111 | */ 112 | #define HYStockChartTimeLineBelowViewMaxY (self.frame.size.height) 113 | 114 | /** 115 | * 时分线图的Below最大的X 116 | */ 117 | #define HYStockChartTimeLineBelowViewMaxX (self.frame.size.width) 118 | 119 | /** 120 | * 时分线图的Below最小的X 121 | */ 122 | #define HYStockChartTimeLineBelowViewMinX 0.0 123 | 124 | /** 125 | * 时分线的成交量的线宽 126 | */ 127 | extern CGFloat const HYStockChartTimeLineVolumeLineWidth; 128 | 129 | /** 130 | * 分时线的timeLabelView的高度 131 | */ 132 | extern CGFloat const HYStockChartTimeLineTimeLabelViewHeight; 133 | 134 | /** 135 | * 长按时的线的宽度 136 | */ 137 | extern CGFloat const HYStockChartLongPressVerticalViewWidth; 138 | 139 | 140 | /** 141 | * MA线的宽度 142 | */ 143 | extern CGFloat const HYStockChartMALineWidth; 144 | 145 | /** 146 | * 所有profileView的高度 147 | */ 148 | extern CGFloat const HYStockChartProfileViewHeight; 149 | 150 | //枚举 151 | typedef NS_ENUM(NSUInteger, HYStockChartCenterViewType){ 152 | HYStockChartCenterViewTypeKLine = 1, //K线 153 | HYStockChartCenterViewTypeTimeLine, //分时线 154 | HYStockChartCenterViewTypeBrokenLine //折线(用的是分时线的图) 155 | }; 156 | 157 | #endif 158 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/Model/MJExtension/MJProperty.m: -------------------------------------------------------------------------------- 1 | // 2 | // MJProperty.m 3 | // MJExtensionExample 4 | // 5 | // Created by MJ Lee on 15/4/17. 6 | // Copyright (c) 2015年 itcast. All rights reserved. 7 | // 8 | 9 | #import "MJProperty.h" 10 | #import "MJType.h" 11 | #import "MJFoundation.h" 12 | #import "MJConst.h" 13 | 14 | @interface MJProperty() 15 | @property (strong, nonatomic) NSMutableDictionary *keyDict; 16 | @property (strong, nonatomic) NSMutableDictionary *keysDict; 17 | @property (strong, nonatomic) NSMutableDictionary *objectClassInArrayDict; 18 | @end 19 | 20 | @implementation MJProperty 21 | 22 | - (NSMutableDictionary *)keyDict 23 | { 24 | if (!_keyDict) { 25 | self.keyDict = [NSMutableDictionary dictionary]; 26 | } 27 | return _keyDict; 28 | } 29 | 30 | - (NSMutableDictionary *)keysDict 31 | { 32 | if (!_keysDict) { 33 | self.keysDict = [NSMutableDictionary dictionary]; 34 | } 35 | return _keysDict; 36 | } 37 | 38 | - (NSMutableDictionary *)objectClassInArrayDict 39 | { 40 | if (!_objectClassInArrayDict) { 41 | self.objectClassInArrayDict = [NSMutableDictionary dictionary]; 42 | } 43 | return _objectClassInArrayDict; 44 | } 45 | 46 | + (instancetype)cachedPropertyWithProperty:(objc_property_t)property 47 | { 48 | MJProperty *propertyObj = objc_getAssociatedObject(self, property); 49 | if (propertyObj == nil) { 50 | propertyObj = [[self alloc] init]; 51 | propertyObj.property = property; 52 | objc_setAssociatedObject(self, property, propertyObj, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 53 | } 54 | return propertyObj; 55 | } 56 | 57 | - (void)setProperty:(objc_property_t)property 58 | { 59 | _property = property; 60 | 61 | MJAssertParamNotNil(property); 62 | 63 | // 1.属性名 64 | _name = @(property_getName(property)); 65 | 66 | // 2.成员类型 67 | NSString *attrs = @(property_getAttributes(property)); 68 | NSUInteger loc = 1; 69 | NSUInteger len = [attrs rangeOfString:@","].location - loc; 70 | _type = [MJType cachedTypeWithCode:[attrs substringWithRange:NSMakeRange(loc, len)]]; 71 | } 72 | 73 | /** 74 | * 获得成员变量的值 75 | */ 76 | - (id)valueFromObject:(id)object 77 | { 78 | if (_type.KVCDisabled) return [NSNull null]; 79 | return [object valueForKey:_name]; 80 | } 81 | 82 | /** 83 | * 设置成员变量的值 84 | */ 85 | - (void)setValue:(id)value forObject:(id)object 86 | { 87 | if (_type.KVCDisabled || value == nil) return; 88 | [object setValue:value forKey:_name]; 89 | } 90 | 91 | /** 对应着字典中的key */ 92 | - (void)setKey:(NSString *)key forClass:(Class)c 93 | { 94 | if (!key) return; 95 | self.keyDict[NSStringFromClass(c)] = key; 96 | // 如果有多级映射 97 | [self setKeys:[key componentsSeparatedByString:@"."] forClass:c]; 98 | } 99 | - (NSString *)keyFromClass:(Class)c 100 | { 101 | return self.keyDict[NSStringFromClass(c)]; 102 | } 103 | 104 | /** 对应着字典中的多级key */ 105 | - (void)setKeys:(NSArray *)keys forClass:(Class)c 106 | { 107 | if (!keys) return; 108 | self.keysDict[NSStringFromClass(c)] = keys; 109 | } 110 | - (NSArray *)keysFromClass:(Class)c 111 | { 112 | return self.keysDict[NSStringFromClass(c)]; 113 | } 114 | 115 | /** 模型数组中的模型类型 */ 116 | - (void)setObjectClassInArray:(Class)objectClass forClass:(Class)c 117 | { 118 | if (!objectClass) return; 119 | self.objectClassInArrayDict[NSStringFromClass(c)] = objectClass; 120 | } 121 | - (Class)objectClassInArrayFromClass:(Class)c 122 | { 123 | return self.objectClassInArrayDict[NSStringFromClass(c)]; 124 | } 125 | @end 126 | -------------------------------------------------------------------------------- /RRStock/RRStock/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 TARGET_OS_IPHONE || TARGET_OS_TV 33 | 34 | @property (nonatomic, strong, readonly) MASViewAttribute *leftMargin; 35 | @property (nonatomic, strong, readonly) MASViewAttribute *rightMargin; 36 | @property (nonatomic, strong, readonly) MASViewAttribute *topMargin; 37 | @property (nonatomic, strong, readonly) MASViewAttribute *bottomMargin; 38 | @property (nonatomic, strong, readonly) MASViewAttribute *leadingMargin; 39 | @property (nonatomic, strong, readonly) MASViewAttribute *trailingMargin; 40 | @property (nonatomic, strong, readonly) MASViewAttribute *centerXWithinMargins; 41 | @property (nonatomic, strong, readonly) MASViewAttribute *centerYWithinMargins; 42 | 43 | #endif 44 | 45 | - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *make))block; 46 | - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *make))block; 47 | - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *make))block; 48 | 49 | @end 50 | 51 | #define MAS_ATTR_FORWARD(attr) \ 52 | - (MASViewAttribute *)attr { \ 53 | return [self mas_##attr]; \ 54 | } 55 | 56 | @implementation MAS_VIEW (MASShorthandAdditions) 57 | 58 | MAS_ATTR_FORWARD(top); 59 | MAS_ATTR_FORWARD(left); 60 | MAS_ATTR_FORWARD(bottom); 61 | MAS_ATTR_FORWARD(right); 62 | MAS_ATTR_FORWARD(leading); 63 | MAS_ATTR_FORWARD(trailing); 64 | MAS_ATTR_FORWARD(width); 65 | MAS_ATTR_FORWARD(height); 66 | MAS_ATTR_FORWARD(centerX); 67 | MAS_ATTR_FORWARD(centerY); 68 | MAS_ATTR_FORWARD(baseline); 69 | 70 | #if TARGET_OS_IPHONE || TARGET_OS_TV 71 | 72 | MAS_ATTR_FORWARD(leftMargin); 73 | MAS_ATTR_FORWARD(rightMargin); 74 | MAS_ATTR_FORWARD(topMargin); 75 | MAS_ATTR_FORWARD(bottomMargin); 76 | MAS_ATTR_FORWARD(leadingMargin); 77 | MAS_ATTR_FORWARD(trailingMargin); 78 | MAS_ATTR_FORWARD(centerXWithinMargins); 79 | MAS_ATTR_FORWARD(centerYWithinMargins); 80 | 81 | #endif 82 | 83 | - (MASViewAttribute *(^)(NSLayoutAttribute))attribute { 84 | return [self mas_attribute]; 85 | } 86 | 87 | - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *))block { 88 | return [self mas_makeConstraints:block]; 89 | } 90 | 91 | - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *))block { 92 | return [self mas_updateConstraints:block]; 93 | } 94 | 95 | - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *))block { 96 | return [self mas_remakeConstraints:block]; 97 | } 98 | 99 | @end 100 | 101 | #endif 102 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/StockChartView/StockProfileView/TimeLineLongPressProfileView/HYTimeLineLongPressProfileView.m: -------------------------------------------------------------------------------- 1 | // 2 | // HYTimeLineLongPressProfileView.m 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/6/8. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import "HYTimeLineLongPressProfileView.h" 10 | #import "HYStockChartGloablVariable.h" 11 | #import "HYTimeLineModel.h" 12 | #import "UIColor+HYStockChart.h" 13 | #import "NSDateFormatter+HYStockChart.h" 14 | #import "HYStockChartTool.h" 15 | 16 | @interface HYTimeLineLongPressProfileView () 17 | 18 | @property (weak, nonatomic) IBOutlet UILabel *chineseNameLabel; 19 | 20 | @property (weak, nonatomic) IBOutlet UILabel *symbolLabel; 21 | 22 | @property (weak, nonatomic) IBOutlet UILabel *priceLabel; 23 | 24 | 25 | 26 | @property (weak, nonatomic) IBOutlet UILabel *appliesLabel; 27 | 28 | @property (weak, nonatomic) IBOutlet UILabel *volumeLabel; 29 | 30 | @property (weak, nonatomic) IBOutlet UILabel *volumeNameLabel; 31 | 32 | 33 | @property (weak, nonatomic) IBOutlet UILabel *timeLabel; 34 | 35 | @property (weak, nonatomic) IBOutlet UILabel *dateLabel; 36 | 37 | 38 | @end 39 | 40 | @implementation HYTimeLineLongPressProfileView 41 | 42 | +(instancetype)timeLineLongPressProfileView 43 | { 44 | HYTimeLineLongPressProfileView *timeLineLongPressProfileView = [[[NSBundle mainBundle] loadNibNamed:@"HYTimeLineLongPressProfileView" owner:nil options:nil] lastObject]; 45 | return timeLineLongPressProfileView; 46 | } 47 | 48 | -(void)awakeFromNib 49 | { 50 | [super awakeFromNib]; 51 | self.backgroundColor = [UIColor assistBackgroundColor]; 52 | self.chineseNameLabel.textColor = [UIColor mainTextColor]; 53 | self.symbolLabel.textColor = [UIColor assistTextColor]; 54 | self.priceLabel.textColor = [UIColor mainTextColor]; 55 | self.appliesLabel.textColor = [UIColor mainTextColor]; 56 | self.volumeLabel.textColor = [UIColor mainTextColor]; 57 | self.volumeNameLabel.textColor = [UIColor assistTextColor]; 58 | self.timeLabel.textColor = [UIColor mainTextColor]; 59 | self.dateLabel.textColor = [UIColor assistTextColor]; 60 | } 61 | 62 | -(void)setTimeLineModel:(HYTimeLineModel *)timeLineModel 63 | { 64 | NSDateFormatter *formatter = [NSDateFormatter shareDateFormatter]; 65 | _timeLineModel = timeLineModel; 66 | self.chineseNameLabel.text = [HYStockChartGloablVariable stockChineseName]; 67 | self.symbolLabel.text = [HYStockChartGloablVariable stockSymbol]; 68 | NSString *currencySymbol = [HYStockChartTool currencySymbol]; 69 | self.priceLabel.text = [NSString stringWithFormat:@"%@%.2f",currencySymbol,timeLineModel.currentPrice]; 70 | self.appliesLabel.text = [NSString stringWithFormat:@"%.2f%%",timeLineModel.PercentChangeFromPreClose]; 71 | UIColor *appliesTextColor = timeLineModel.PercentChangeFromPreClose > 0 ? [UIColor increaseColor] : [UIColor decreaseColor]; 72 | self.appliesLabel.textColor = appliesTextColor; 73 | NSString *volumeString = [NSString stringWithFormat:@"%.ld",timeLineModel.volume]; 74 | if (volumeString.length >= 9 ) { 75 | volumeString = [NSString stringWithFormat:@"%.2f亿股",timeLineModel.volume/100000000.0]; 76 | }else{ 77 | volumeString = [NSString stringWithFormat:@"%.2f万股",timeLineModel.volume/10000.0]; 78 | } 79 | self.volumeLabel.text = volumeString; 80 | formatter.dateFormat = @"MM-dd-yyyy hh:mm:ss a"; 81 | NSDate *date = [formatter dateFromString:timeLineModel.currentTime]; 82 | formatter.dateFormat = @"HH:mm:ss"; 83 | NSString *timeStr = [formatter stringFromDate:date]; 84 | formatter.dateFormat = @"yyyy-dd-MM"; 85 | NSString *dateStr = [formatter stringFromDate:date]; 86 | self.timeLabel.text = timeStr; 87 | self.dateLabel.text = dateStr; 88 | } 89 | 90 | 91 | @end 92 | -------------------------------------------------------------------------------- /RRStock/RRStock/MasterViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // MasterViewController.m 3 | // RRStock 4 | // 5 | // Created by 曾文亮 on 16/11/24. 6 | // Copyright © 2016年 liang. All rights reserved. 7 | // 8 | 9 | #import "MasterViewController.h" 10 | #import "DetailViewController.h" 11 | 12 | @interface MasterViewController () 13 | 14 | @property NSMutableArray *objects; 15 | @end 16 | 17 | @implementation MasterViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | // Do any additional setup after loading the view, typically from a nib. 22 | self.navigationItem.leftBarButtonItem = self.editButtonItem; 23 | 24 | UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(insertNewObject:)]; 25 | self.navigationItem.rightBarButtonItem = addButton; 26 | self.detailViewController = (DetailViewController *)[[self.splitViewController.viewControllers lastObject] topViewController]; 27 | } 28 | 29 | - (void)viewWillAppear:(BOOL)animated { 30 | self.clearsSelectionOnViewWillAppear = self.splitViewController.isCollapsed; 31 | [super viewWillAppear:animated]; 32 | } 33 | 34 | - (void)didReceiveMemoryWarning { 35 | [super didReceiveMemoryWarning]; 36 | // Dispose of any resources that can be recreated. 37 | } 38 | 39 | - (void)insertNewObject:(id)sender { 40 | if (!self.objects) { 41 | self.objects = [[NSMutableArray alloc] init]; 42 | } 43 | [self.objects insertObject:[NSDate date] atIndex:0]; 44 | NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0]; 45 | [self.tableView insertRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic]; 46 | } 47 | 48 | #pragma mark - Segues 49 | 50 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 51 | if ([[segue identifier] isEqualToString:@"showDetail"]) { 52 | NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow]; 53 | NSDate *object = self.objects[indexPath.row]; 54 | DetailViewController *controller = (DetailViewController *)[[segue destinationViewController] topViewController]; 55 | [controller setDetailItem:object]; 56 | controller.navigationItem.leftBarButtonItem = self.splitViewController.displayModeButtonItem; 57 | controller.navigationItem.leftItemsSupplementBackButton = YES; 58 | } 59 | } 60 | 61 | #pragma mark - Table View 62 | 63 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 64 | return 1; 65 | } 66 | 67 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 68 | return self.objects.count; 69 | } 70 | 71 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 72 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath]; 73 | 74 | NSDate *object = self.objects[indexPath.row]; 75 | cell.textLabel.text = [object description]; 76 | return cell; 77 | } 78 | 79 | - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { 80 | // Return NO if you do not want the specified item to be editable. 81 | return YES; 82 | } 83 | 84 | - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { 85 | if (editingStyle == UITableViewCellEditingStyleDelete) { 86 | [self.objects removeObjectAtIndex:indexPath.row]; 87 | [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; 88 | } else if (editingStyle == UITableViewCellEditingStyleInsert) { 89 | // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view. 90 | } 91 | } 92 | 93 | @end 94 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/StockChartView/StockProfileView/BrokenLineLongPressProfileView/HYBrokenLineLongPressProfileView.m: -------------------------------------------------------------------------------- 1 | // 2 | // JMBBrokenLineLongPressProfileView.m 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/6/9. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import "HYBrokenLineLongPressProfileView.h" 10 | #import "UIColor+HYStockChart.h" 11 | #import "HYStockChartGloablVariable.h" 12 | #import "HYTimeLineModel.h" 13 | #import "NSDateFormatter+HYStockChart.h" 14 | #import "HYStockChartTool.h" 15 | 16 | @interface HYBrokenLineLongPressProfileView () 17 | 18 | @property (weak, nonatomic) IBOutlet UILabel *chineseNameLabel; 19 | 20 | @property (weak, nonatomic) IBOutlet UILabel *symbolLabel; 21 | 22 | @property (weak, nonatomic) IBOutlet UILabel *priceLabel; 23 | 24 | @property (weak, nonatomic) IBOutlet UILabel *appliesLabel; 25 | 26 | @property (weak, nonatomic) IBOutlet UILabel *volumeLabel; 27 | 28 | @property (weak, nonatomic) IBOutlet UILabel *volumeNameLabel; 29 | 30 | @property (weak, nonatomic) IBOutlet UILabel *timeLabel; 31 | 32 | @property (weak, nonatomic) IBOutlet UILabel *dateLabel; 33 | 34 | @end 35 | 36 | @implementation HYBrokenLineLongPressProfileView 37 | 38 | +(instancetype)brokenLineLongPressProfileView 39 | { 40 | HYBrokenLineLongPressProfileView *brokenLineLongPressProfileView = (HYBrokenLineLongPressProfileView *)[[[NSBundle mainBundle] loadNibNamed:@"HYBrokenLineLongPressProfileView" owner:nil options:nil] lastObject]; 41 | return brokenLineLongPressProfileView; 42 | } 43 | 44 | -(void)awakeFromNib 45 | { 46 | [super awakeFromNib]; 47 | self.backgroundColor = [UIColor assistBackgroundColor]; 48 | self.chineseNameLabel.textColor = [UIColor mainTextColor]; 49 | self.symbolLabel.textColor = [UIColor assistTextColor]; 50 | self.priceLabel.textColor = [UIColor mainTextColor]; 51 | self.appliesLabel.textColor = [UIColor assistTextColor]; 52 | self.volumeLabel.textColor = [UIColor mainTextColor]; 53 | self.volumeNameLabel.textColor = [UIColor assistTextColor]; 54 | self.timeLabel.textColor = [UIColor mainTextColor]; 55 | self.dateLabel.textColor = [UIColor assistTextColor]; 56 | } 57 | 58 | -(void)setTimeLineModel:(HYTimeLineModel *)timeLineModel 59 | { 60 | NSDateFormatter *formatter = [NSDateFormatter shareDateFormatter]; 61 | _timeLineModel = timeLineModel; 62 | self.chineseNameLabel.text = [HYStockChartGloablVariable stockChineseName]; 63 | self.symbolLabel.text = [HYStockChartGloablVariable stockSymbol]; 64 | 65 | NSString *currencySymbol = [HYStockChartTool currencySymbol]; 66 | self.priceLabel.text = [NSString stringWithFormat:@"%@%.2f",currencySymbol,timeLineModel.currentPrice]; 67 | self.appliesLabel.text = [NSString stringWithFormat:@"%.2f%%",timeLineModel.PercentChangeFromPreClose]; 68 | UIColor *appliesTextColor = timeLineModel.PercentChangeFromPreClose > 0 ? [UIColor increaseColor] : [UIColor decreaseColor]; 69 | self.appliesLabel.textColor = appliesTextColor; 70 | NSString *volumeString = [NSString stringWithFormat:@"%.ld",timeLineModel.volume]; 71 | if (volumeString.length >= 9 ) { 72 | volumeString = [NSString stringWithFormat:@"%.2f亿股",timeLineModel.volume/100000000.0]; 73 | }else{ 74 | volumeString = [NSString stringWithFormat:@"%.2f万股",timeLineModel.volume/10000.0]; 75 | } 76 | self.volumeLabel.text = volumeString; 77 | formatter.dateFormat = @"MM-dd-yyyy hh:mm:ss a"; 78 | NSDate *date = [formatter dateFromString:timeLineModel.currentTime]; 79 | formatter.dateFormat = @"yyyy-MM-dd"; 80 | NSString *dateStr = [formatter stringFromDate:date]; 81 | self.dateLabel.text = dateStr; 82 | formatter.dateFormat = @"HH:mm"; 83 | NSString *timeStr = [formatter stringFromDate:date]; 84 | self.timeLabel.text = timeStr; 85 | } 86 | 87 | @end 88 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/StockChartYView/HYStockChartYView.m: -------------------------------------------------------------------------------- 1 | // 2 | // HYStockChartPriceView.m 3 | // jimustock 4 | // 5 | // Created by jimubox on 15/5/25. 6 | // Copyright (c) 2015年 jimubox. All rights reserved. 7 | // 8 | 9 | #import "HYStockChartYView.h" 10 | #import "UIFont+HYStockChart.h" 11 | #import "UIColor+HYStockChart.h" 12 | #import "Masonry.h" 13 | 14 | @interface HYStockChartYView () 15 | 16 | @property(nonatomic,strong) UILabel *maxValueLabel; 17 | 18 | @property(nonatomic,strong) UILabel *middleValueLabel; 19 | 20 | @property(nonatomic,strong) UILabel *minValueLabel; 21 | 22 | @end 23 | 24 | @implementation HYStockChartYView 25 | 26 | -(void)setMaxValue:(CGFloat)maxValue 27 | { 28 | _maxValue = maxValue; 29 | self.maxValueLabel.text = [NSString stringWithFormat:@"%.2f",maxValue]; 30 | } 31 | 32 | -(void)setMiddleValue:(CGFloat)middleValue 33 | { 34 | _middleValue = middleValue; 35 | self.middleValueLabel.text = [NSString stringWithFormat:@"%.2f",middleValue]; 36 | } 37 | 38 | -(void)setMinValue:(CGFloat)minValue 39 | { 40 | _minValue = minValue; 41 | self.minValueLabel.text = [NSString stringWithFormat:@"%.2f",minValue]; 42 | } 43 | 44 | -(void)setMinLabelText:(NSString *)minLabelText 45 | { 46 | _minLabelText = minLabelText; 47 | self.minValueLabel.text = minLabelText; 48 | } 49 | 50 | #pragma mark - get方法 51 | #pragma mark maxPriceLabel的get方法 52 | -(UILabel *)maxValueLabel 53 | { 54 | if (!_maxValueLabel) { 55 | _maxValueLabel = [self private_createLabel]; 56 | [self addSubview:_maxValueLabel]; 57 | [_maxValueLabel mas_makeConstraints:^(MASConstraintMaker *make) { 58 | 59 | make.right.equalTo(self); 60 | if (self.minLabelText) 61 | { 62 | make.top.equalTo(self); 63 | } 64 | else 65 | { 66 | make.top.equalTo(self).offset(10); 67 | } 68 | make.height.equalTo(@20); 69 | make.width.equalTo(self); 70 | }]; 71 | } 72 | return _maxValueLabel; 73 | } 74 | 75 | #pragma mark middlePriceLabel的get方法 76 | -(UILabel *)middleValueLabel 77 | { 78 | if (!_middleValueLabel) { 79 | _middleValueLabel = [self private_createLabel]; 80 | [self addSubview:_middleValueLabel]; 81 | [_middleValueLabel mas_makeConstraints:^(MASConstraintMaker *make) { 82 | make.centerY.equalTo(self); 83 | make.right.equalTo(self); 84 | make.height.equalTo(self.maxValueLabel); 85 | make.width.equalTo(self.maxValueLabel); 86 | }]; 87 | } 88 | return _middleValueLabel; 89 | } 90 | 91 | #pragma mark minPriceLabel的get方法 92 | -(UILabel *)minValueLabel 93 | { 94 | if (!_minValueLabel) { 95 | _minValueLabel = [self private_createLabel]; 96 | [self addSubview:_minValueLabel]; 97 | [_minValueLabel mas_makeConstraints:^(MASConstraintMaker *make) { 98 | 99 | if (self.minLabelText) 100 | { 101 | make.bottom.equalTo(self); 102 | } 103 | else 104 | { 105 | make.bottom.equalTo(self).offset(-20); 106 | 107 | } 108 | //make.bottom.equalTo(self).offset(-20); 109 | make.right.equalTo(self); 110 | make.height.equalTo(self.maxValueLabel); 111 | make.width.equalTo(self.maxValueLabel); 112 | }]; 113 | } 114 | return _minValueLabel; 115 | } 116 | 117 | #pragma mark - 私有方法 118 | #pragma mark 创建Label 119 | -(UILabel *)private_createLabel 120 | { 121 | UILabel *label = [UILabel new]; 122 | label.font = [UIFont f39Font]; 123 | label.textColor = [UIColor assistTextColor]; 124 | label.textAlignment = NSTextAlignmentCenter; 125 | return label; 126 | } 127 | 128 | @end 129 | -------------------------------------------------------------------------------- /RRStock/RRStock/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // RRStock 4 | // 5 | // Created by 曾文亮 on 16/11/24. 6 | // Copyright © 2016年 liang. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "DetailViewController.h" 11 | #import "StockInfoDetailViewController.h" 12 | 13 | @interface AppDelegate () 14 | 15 | @end 16 | 17 | @implementation AppDelegate 18 | 19 | 20 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 21 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 22 | StockInfoDetailViewController *stockInfoVC = [[StockInfoDetailViewController alloc] init]; 23 | UINavigationController *nav = 24 | [[UINavigationController alloc] initWithRootViewController:stockInfoVC]; 25 | [nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"navigationBarBg"] 26 | forBarPosition:UIBarPositionTopAttached 27 | barMetrics:UIBarMetricsDefault]; 28 | NSDictionary *attr = @{NSForegroundColorAttributeName : [UIColor whiteColor]}; 29 | //设置中间字体的颜色 30 | [nav.navigationBar setTitleTextAttributes:attr]; 31 | 32 | //设置barButtonItem的图片和内容的颜色 33 | [nav.navigationBar setTintColor:[UIColor whiteColor]]; 34 | self.window.rootViewController = nav; 35 | self.window.backgroundColor = [UIColor whiteColor]; 36 | [self.window makeKeyAndVisible]; 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 throttle down OpenGL ES frame rates. Games should use this method to pause the game. 43 | } 44 | 45 | - (void)applicationDidEnterBackground:(UIApplication *)application { 46 | // 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. 47 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 48 | } 49 | 50 | - (void)applicationWillEnterForeground:(UIApplication *)application { 51 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 52 | } 53 | 54 | - (void)applicationDidBecomeActive:(UIApplication *)application { 55 | // 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. 56 | } 57 | 58 | - (void)applicationWillTerminate:(UIApplication *)application { 59 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 60 | } 61 | 62 | #pragma mark - Split view 63 | 64 | - (BOOL)splitViewController:(UISplitViewController *)splitViewController collapseSecondaryViewController:(UIViewController *)secondaryViewController ontoPrimaryViewController:(UIViewController *)primaryViewController { 65 | if ([secondaryViewController isKindOfClass:[UINavigationController class]] && [[(UINavigationController *)secondaryViewController topViewController] isKindOfClass:[DetailViewController class]] && ([(DetailViewController *)[(UINavigationController *)secondaryViewController topViewController] detailItem] == nil)) { 66 | // Return YES to indicate that we have handled the collapse by doing nothing; the secondary controller will be discarded. 67 | return YES; 68 | } else { 69 | return NO; 70 | } 71 | } 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /RRStock/RRStock/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 TARGET_OS_IPHONE || TARGET_OS_TV 36 | 37 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_leftMargin; 38 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_rightMargin; 39 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_topMargin; 40 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomMargin; 41 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_leadingMargin; 42 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_trailingMargin; 43 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_centerXWithinMargins; 44 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_centerYWithinMargins; 45 | 46 | #endif 47 | 48 | /** 49 | * a key to associate with this view 50 | */ 51 | @property (nonatomic, strong) id mas_key; 52 | 53 | /** 54 | * Finds the closest common superview between this view and another view 55 | * 56 | * @param view other view 57 | * 58 | * @return returns nil if common superview could not be found 59 | */ 60 | - (instancetype)mas_closestCommonSuperview:(MAS_VIEW *)view; 61 | 62 | /** 63 | * Creates a MASConstraintMaker with the callee view. 64 | * Any constraints defined are added to the view or the appropriate superview once the block has finished executing 65 | * 66 | * @param block scope within which you can build up the constraints which you wish to apply to the view. 67 | * 68 | * @return Array of created MASConstraints 69 | */ 70 | - (NSArray *)mas_makeConstraints:(void(^)(MASConstraintMaker *make))block; 71 | 72 | /** 73 | * Creates a MASConstraintMaker with the callee view. 74 | * Any constraints defined are added to the view or the appropriate superview once the block has finished executing. 75 | * If an existing constraint exists then it will be updated instead. 76 | * 77 | * @param block scope within which you can build up the constraints which you wish to apply to the view. 78 | * 79 | * @return Array of created/updated MASConstraints 80 | */ 81 | - (NSArray *)mas_updateConstraints:(void(^)(MASConstraintMaker *make))block; 82 | 83 | /** 84 | * Creates a MASConstraintMaker with the callee view. 85 | * Any constraints defined are added to the view or the appropriate superview once the block has finished executing. 86 | * All constraints previously installed for the view will be removed. 87 | * 88 | * @param block scope within which you can build up the constraints which you wish to apply to the view. 89 | * 90 | * @return Array of created/updated MASConstraints 91 | */ 92 | - (NSArray *)mas_remakeConstraints:(void(^)(MASConstraintMaker *make))block; 93 | 94 | @end 95 | -------------------------------------------------------------------------------- /RRStock/RRStock/Stock/View/HYStockChart/TimeLine/UIView+HXCircleAnimation.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+HXCircleAnimation.m 3 | // HXCircleAnimation 4 | // 5 | // Created by TheLittleBoy on 16/3/21. 6 | // Copyright © 2016年 华夏大地教育. All rights reserved. 7 | // 8 | 9 | #import "UIView+HXCircleAnimation.h" 10 | 11 | @implementation UIView (HXCircleAnimation) 12 | 13 | -(void)showCircleAnimationLayerWithColor:(UIColor *)circleColor andScale:(CGFloat)scale 14 | { 15 | if (!self.superview && circleColor) { 16 | return; 17 | } 18 | 19 | CGRect pathFrame = CGRectMake(-CGRectGetMidX(self.bounds), -CGRectGetMidY(self.bounds), self.bounds.size.width, self.bounds.size.height); 20 | UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:pathFrame cornerRadius:self.layer.cornerRadius]; 21 | 22 | CGPoint shapePosition = [self.superview convertPoint:self.center fromView:self.superview]; 23 | 24 | //内圈 25 | CAShapeLayer *circleShape = [CAShapeLayer layer]; 26 | circleShape.path = path.CGPath; 27 | circleShape.position = shapePosition; 28 | circleShape.fillColor = [UIColor clearColor].CGColor; 29 | circleShape.opacity = 0; 30 | circleShape.strokeColor = circleColor.CGColor;// 31 | circleShape.lineWidth = 0.6; 32 | 33 | [self.superview.layer addSublayer:circleShape]; 34 | 35 | 36 | CABasicAnimation *scaleAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; 37 | scaleAnimation.fromValue = [NSValue valueWithCATransform3D:CATransform3DIdentity]; 38 | scaleAnimation.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(scale, scale, 1)]; 39 | //scaleAnimation.duration = 2; 40 | scaleAnimation.duration = 1.0; 41 | scaleAnimation.repeatCount = MAXFLOAT; 42 | scaleAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; 43 | [circleShape addAnimation:scaleAnimation forKey:nil]; 44 | 45 | CABasicAnimation *alphaAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"]; 46 | alphaAnimation.fromValue = @1; 47 | alphaAnimation.toValue = @0; 48 | // alphaAnimation.duration = 1.8; 49 | alphaAnimation.duration = 1.0; 50 | alphaAnimation.repeatCount = MAXFLOAT; 51 | alphaAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; 52 | [circleShape addAnimation:alphaAnimation forKey:nil]; 53 | 54 | 55 | //内圈 56 | 57 | CAShapeLayer *circleShape2 = [CAShapeLayer layer]; 58 | circleShape2.path = path.CGPath; 59 | circleShape2.position = shapePosition; 60 | circleShape2.fillColor = circleColor.CGColor;// 61 | circleShape2.opacity = 0; 62 | circleShape2.strokeColor = [UIColor clearColor].CGColor; 63 | circleShape2.lineWidth = 0; 64 | 65 | [self.superview.layer insertSublayer:circleShape2 atIndex:0]; 66 | 67 | CABasicAnimation *scaleAnimation2 = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; 68 | scaleAnimation2.fromValue = [NSValue valueWithCATransform3D:CATransform3DIdentity]; 69 | scaleAnimation2.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(scale, scale, 1)]; 70 | // scaleAnimation2.duration = 2; 71 | scaleAnimation2.duration = 1.0; 72 | scaleAnimation2.repeatCount = MAXFLOAT; 73 | scaleAnimation2.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; 74 | [circleShape2 addAnimation:scaleAnimation2 forKey:nil]; 75 | 76 | CABasicAnimation *alphaAnimation2 = [CABasicAnimation animationWithKeyPath:@"opacity"]; 77 | alphaAnimation2.fromValue = @0.8; 78 | alphaAnimation2.toValue = @0; 79 | // alphaAnimation2.duration = 1.7; 80 | alphaAnimation2.duration = 1.0; 81 | alphaAnimation2.repeatCount = MAXFLOAT; 82 | alphaAnimation2.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; 83 | [circleShape2 addAnimation:alphaAnimation2 forKey:nil]; 84 | 85 | // dispatch_time_t time = dispatch_time(DISPATCH_TIME_NOW, 2 * NSEC_PER_SEC); 86 | // dispatch_after(time, dispatch_get_main_queue(), ^{ 87 | // [circleShape removeFromSuperlayer]; 88 | // [circleShape2 removeFromSuperlayer]; 89 | // }); 90 | 91 | } 92 | @end 93 | --------------------------------------------------------------------------------