问题标签 [svgkit]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1229 浏览

ios - Svg image is not properly showing using SVGKit

I have used SVGKit library to show svg images but the is some extra numbering in the images.

Here is the actual image:

enter image description here

But the image shown in the imageView looks like this:

enter image description here

As you can see in second image the numbers are showing on top and bottom in bunches are not part of the original image.

How do I resolve this issue.I am using the svg image first time so I don't know the reason behind this.

Here is the code to show svg image from url:

0 投票
1 回答
390 浏览

objective-c - 如何在 Swift 中识别 SVG 对象内部的触摸?

我目前正在构建一个应用程序,我需要在其中识别 SVG 地图中的接触点。所以我有一个map多重rectangles的,当用户触摸其中一个时,rectangles需要触发一个动作。我该如何解决这个问题?

一种选择是数学计算触摸位置是否位于矩形之间,但我不是数学天才。

我的首选选择是使用框架。我找到了 SVGKit 框架,但不幸的是它是用 Objective C 编写的。

0 投票
1 回答
2090 浏览

ios - 在 iOS Swift 中使用 SvgKit 更改 SVG 颜色

我正在使用 SVGKit 库将svg渲染到图像视图中。SVG 渲染完美,但问题是我无法填充 SVG 颜色。我在 Objective C 中发现了一些对我没有帮助的例子。这里我使用的是 Swift5。请找到随附的控制器代码。提前致谢。

代码:

0 投票
1 回答
210 浏览

swift - 金刚鹦鹉 SVG 图像

所以我试图让一个 SVG 图像在 SwiftUI 中显示,但是插件 Macaw 的文档写得不好——根据 GitHub。

那么我怎样才能使下面的代码工作呢?

首先我在 pod install 之后导入这个:

然后我添加这个:

但是我得到:

我也安装了SVGKit,我正试图让它与它一起工作。

0 投票
1 回答
92 浏览

swift - Xcode 12 and SVG from a string/text

I'm trying to manipulate SVG using simple XML codes to add SVG into Xcode using the framework SVGKit.

But I got a fatal error:

Fatal error: Unexpectedly found nil while unwrapping an Optional value: file aiSoccer/DetailViewController.swift, line 86

Here is the code:

I'm a noob with Xcode/Swift, can you help me?

0 投票
0 回答
32 浏览

swift - 如何在 SVG swift 中解析文本元素?

我正在使用PocketSVG、SwiftSVG 和 SVGKit库来解析 SVG 元素并转换为 CALayer。但我不知道如何从 SVG 中快速解析Text元素及其属性。

我想从 SVG 文本元素下方获取My Text字符串。我该如何解析它?

0 投票
1 回答
48 浏览

ios - 如何将 svg+xml base64 转换为 UIImage?

我只是有这样的字符串:

"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAwIiBoZWlnaHQ9IjYwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CgogPGc+CiAgPHRpdGxlPkxheWVyIDE8L3RpdGxlPgogIDxwYXRoIGlkPSJzdmdfMSIgc3Ryb2tlPSIjMDAwIiBmaWxsPSIjZmZmIi8+CiAgPHJlY3Qgcng9IjYyIiBzdHJva2Utd2lkdGg9IjEwIiBpZD0ic3ZnXzIiIGhlaWdodD0iMzAzIiB3aWR0aD0iNjI5IiB5PSIxMTIiIHg9IjkxIiBzdHJva2U9IiMwMDAiIGZpbGw9IiNmZmYiLz4KICA8ZGVmcz4KICA8cmVjdCByeT0iNjMiIHJ4PSI2MyIgc3Ryb2tlLXdpZHRoPSIxMCIgaWQ9InJlY3QiIGhlaWdodD0iMTI2IiB3aWR0aD0iMTI2IiB5PSIxNTAiIHg9IjE0MCIgc3Ryb2tlPSIjMDAwIiBmaWxsPSIjZmZmIi8+CiAgPGNsaXBQYXRoIGlkPSJjbGlwIj4KICAgICAgPHVzZSB4bGluazpocmVmPSIjcmVjdCIvPgogICAgPC9jbGlwUGF0aD4KPC9kZWZzPgoKICA8dXNlIHhsaW5rOmhyZWY9IiNyZWN0IiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZT0iYmxhY2siLz4KICA8aW1hZ2UgeGxpbms6aHJlZj0iZGF0YTppbWFnZS9wbmc7YmFzZTY0LG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