简体   繁体   English

什么是Cocoa或Cocoa-touch的好矢量库?

[英]What is a good vector library for Cocoa or Cocoa-touch?

I'm looking for a good vector library for displaying animated graphics on the iPhone. 我正在寻找一个好的矢量库,用于在iPhone上显示动画图形。 Something that could possibly display SVG. 有可能显示SVG的东西。 Anyone have any ideas or insights? 任何人有任何想法或见解?

Quartz, ie the vector graphics library that's already built into the phone. Quartz,即已经内置到手机中的矢量图形库。 Depending on the requirements, you could write a parser for the parts of the SVG spec you actually plan on using. 根据要求,您可以为实际计划使用的SVG规范部分编写解析器。 For example perhaps your application only requires the Tiny SVG spec. 例如,您的应用程序可能只需要Tiny SVG规范。

Sorry that this answer doesn't point to a framework that already exists, but depending on how badly you really need it, it might make sense to roll your own or a start an open source project (especially since this is the kind of project people would probably be quite happy to contribute to). 很抱歉,这个答案并没有指向一个已经存在的框架,但是根据你真正需要它的程度,可能有必要推出自己的或开始一个开源项目(特别是因为这是一种项目的人可能很乐意为此做出贡献)。

github.com/SVGKit/SVGKit - almost-but-not-quite standards compliant SVG lib on iOS. github.com/SVGKit/SVGKit - iOS上几乎不符合标准的SVG lib。 (FYI i'm one of the maintainers). (仅供参考,我是其中一位维护者)。

  • WebKit WebKit的
  • libsvg libsvg
  • Cairo 开罗

GCDrawKit is an outstanding vector illustration framework, but it does not have native support for SVG yet and is built around AppKit, so it's not iPhone compatible. GCDrawKit是一个出色的矢量插图框架,但它还没有对SVG的原生支持,并且是围绕AppKit构建的,因此它不兼容iPhone。 It also is not geared towards animation. 它也不适合动画。

WebKit provides native support for SVG on the Mac, and even lets you manipulate the DOM to modify or save SVG, but I don't believe you're given enough access to it on the iPhone to do the same there. WebKit在Mac上为SVG提供本机支持,甚至可以让你操作DOM来修改或保存SVG,但我不相信你在iPhone上有足够的权限来访问它以便在那里做同样的事情。

Your best bet is to write a parser for SVG XML (it isn't too difficult a format), use Quartz for drawing, and back it up with Core Animation for the animated elements. 最好的办法是为SVG XML编写一个解析器(格式不是太难),使用Quartz进行绘制,然后使用Core Animation为动画元素进行备份。

UIWebView works great for SVG. UIWebView非常适合SVG。 Just drop it in you app in IB, load a file into it and you are set. 只需将其放入IB中的应用程序中,将文件加载到其中即可进行设置。

You can then call JavaScript from ObjC, very useful for manipulation. 然后,您可以从ObjC调用JavaScript,这对于操作非常有用。

I just answered another cocoa-touch SVG question: Drawing vector graphics on iphone 我刚回答了另一个可可触摸SVG问题: 在iphone上绘制矢量图形

but my general suggestion was to look at GitHub for answers (Objective-c & SVG Search) 但我的一般建议是看看GitHub的答案(Objective-c&SVG Search)

https://github.com/search?type=Everything&language=objective-c&q=SVG https://github.com/search?type=Everything&language=objective-c&q=SVG

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM