AAChartKit 项目教程
1、项目的目录结构及介绍
AAChartKit 项目的目录结构如下:
AAChartKit/
├── AAChartKitDemo/
│ ├── AAChartKitDemo.xcodeproj
│ ├── AAChartKitDemo
│ ├── AAChartKitDemoTests
│ ├── AAChartKitDemoUITests
│ └── AAChartKitLib
├── fastlane/
├── .gitignore
├── AAChartKit.podspec
├── CHINESE-README.md
├── LICENSE
├── README.md
└── _config.yml
目录结构介绍
- AAChartKitDemo: 包含项目的演示应用,包括 Xcode 项目文件、应用代码、测试代码和库代码。
- fastlane: 包含自动化部署和发布的配置文件。
- .gitignore: Git 忽略文件配置。
- AAChartKit.podspec: CocoaPods 配置文件。
- CHINESE-README.md: 中文 README 文件。
- LICENSE: 项目许可证文件。
- README.md: 项目介绍文件。
- _config.yml: 项目配置文件。
2、项目的启动文件介绍
AAChartKit 项目的启动文件位于 AAChartKitDemo/AAChartKitDemo/ViewController.m
。该文件是项目的主视图控制器,负责初始化和显示图表。
启动文件代码示例
#import "ViewController.h"
#import "AAChartKit.h"
@interface ViewController ()
@property (nonatomic, strong) AAChartView *aaChartView;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
CGFloat chartViewWidth = self.view.frame.size.width;
CGFloat chartViewHeight = self.view.frame.size.height - 250;
_aaChartView = [[AAChartView alloc]init];
_aaChartView.frame = CGRectMake(0, 60, chartViewWidth, chartViewHeight);
_aaChartView.scrollEnabled = NO;
[self.view addSubview:_aaChartView];
AAChartModel *aaChartModel = AAChartModel.new
.chartTypeSet(AAChartTypeArea)
.titleSet(@"THE HEAT OF PROGRAMMING LANGUAGE")
.subtitleSet(@"Virtual Data");
[_aaChartView aa_drawChartWithChartModel:aaChartModel];
}
@end
3、项目的配置文件介绍
AAChartKit 项目的配置文件主要包括以下几个:
AAChartKit.podspec
该文件是 CocoaPods 的配置文件,用于定义项目的版本、依赖等信息。
Pod::Spec.new do |s|
s.name = "AAChartKit"
s.version = "4.0.0"
s.summary = "A very powerful and easy to use beautiful chart library for iOS"
s.description = <<-DESC
AAChartKit is a very powerful and easy to use beautiful chart library for iOS, based on the open source Highcharts JS.
DESC
s.homepage = "https://github.com/AAChartModel/AAChartKit"
s.license = "MIT"
s.author = { "An An" => "18256973864@163.com" }
s.platform = :ios, "6.0"
s.source = { :git => "https://github.com/AAChartModel/AAChartKit.git", :tag => "#{s.version}" }
s.source_files = "AAChartKitLib/**/*.{h,m}"
s.requires_arc = true
end
.gitignore
该文件定义了 Git 版本控制系统中需要忽略的文件和目录。
# Xcode
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
# CocoaPods
Pods/