iOS图表Charts的使用

说到Charts真是一把心酸泪,直接git上下载的Charts的demo直接运行就报各种错误, 整了几天电脑硬盘都被格式化了也不知道为啥,说是要装什么Carthage整了一天,装不上,也是就另寻他路了,他路走的也曲折,cocoapods安装请参考(第六步失败后,请思考下天朝的网络是不是不给力,反正我是重试多次无用,使用vpn链接国外的网络就安装成功了)不知道是因为电脑系统是10.12的原因,安装个cocoapods一直失败,估计是网络原因吧,不管中间纠结了多久,反正coocoapos是安装上去了,

安装完成后就开始引用第三方库了参考集成Charts

cocoads安装:

说是macos 10.11以上得用 

sudo gem install -n /usr/local/bin cocoapods
pod setup

集成Charts:

新建一个项目TestChatDemos

cd 把工程直接拖过来
touch podfile
open -a xcode podfile 

在podfile文件中输入

platform :ios, '8.1'

use_frameworks!

target 'TestCharsDemo' do

pod 'Charts'

pod 'Charts/Realm'

post_install do |installer|

    installer.pods_project.targets.each do |target|

        target.build_configurations.each do |config|

            config.build_settings['SWIFT_VERSION'] = '3.0'

        end

    end

end

end

pod search Charts
pod install
建立与Swift的桥接文件,建立一个以swift文件,提示是否建立桥接,点击creat bridging header
将pods——testChatDemos。frameworkios添加到 general->embedded binaries
在桥接文件中写上要引用的swift头文件 @import Charts;
用到时导入 #import “testChartDemos-bridging-header.h”的头文件,然后就可以使用Charts里的东西了
使用ChartsDemos里的东西的时候,要配置product module name 为(TestCharsDemo)系统会自动生成

"TestCharsDemo-Swift.h"的文件,需要手动输入,不会提示,将Chart-swift.h的文件换成TestCharsDemo生成的"TestCharsDemo-Swift.h"

这样基本就可以运行程序看到ChartsDemo里的案例了

 

  • 3
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值