php-svg-lib,SVGKit使用

SVGKit导入

从github下载demo

打开"SVGKit-iOS.xcodeproj"

c12f45f3e527?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

目录.png

command + B 编译

找到"libSVGKit-iOS.2.x.x.a" 我这里是“libSVGKit-iOS.2.0.0.a” 在文件夹中显示

c12f45f3e527?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

目标文件.png

前往上层文件夹 选择 Debug-universal / Release-universal 中的 libSVGKit-iOS.2.x.x.a文件 和 usr文件夹,拖入到你的项目中(如果想要 Debug文件,编译时需要在 Xcode-Edit Scheme 中选择 Debug;如果想要 Release文件,需要在 Xcode-Edit Scheme 中选择 Release)

c12f45f3e527?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

目标文件.png

将下图所示的文件加入项目中(可以全部加入,也可根据需要选择)

c12f45f3e527?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

目标文件.png

在 Build Settings 中,"Other Linker Flags" 设置中添加 "-ObjC"

在 Build Phases 中,添加

CoreText

CoreImage

libxml2.dylib

QuartzCore

CoreGraphics

UIKit

下图所示的位置添加"CocoaLumberjack.framework",

c12f45f3e527?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

文件添加.png

恭喜你 导入成功 可以使用了

SVGKit使用

导入头文件(#import "SVGKit.h" #import "SVGKImage.h" #import "SVGKParser.h")

SVGKImage* newImage = [SVGKImage imageNamed:@"myImage.svg"];

SVGKImageView* imageView = [[SVGKFastImageView alloc] initWithSVGKImage:newImage];

[self.view addSubview:imageView];

运行报错了 找了好久不知什么原因

c12f45f3e527?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

报错信息.png

调试了一下 发现是断言,但是并不知道为什么

于是我怀疑是我的svg资源文件有问题,到demo里弄了一个.svg格式的图片资源,发现成功了.

最后放张效果图和链接

c12f45f3e527?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

效果图.png

其他的一些用法后面有空 后续更新

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值