How to render all kinds of SVG files on iPhone? - iphone

For rendering svg file on iPhone I have downloaded a project from GitHub
SVGQuartzRenderer
but it shows the following errors:
UIKit/UIKit.h No such file or directory
(I am not able to add it using add existing frameworks)
Libxml/tree.h:No such file or directory
Expected specifier-qualifier list before xmlParserCtxtPtr
Does anyone know how I can make this project work?
I have also found another framework:
SVGKit.
It works well for some SVG files but not for all.
Is it possible to render any SVG file in iPhone without using UIWebView and are there any tutorials or sample code?

Starting Xcode 12, you can add the .svg file in your Assets Catalog and do this:
let image = UIImage(named: "SomeSVGImage")
ref: https://developer.apple.com/documentation/xcode-release-notes/xcode-12-beta-release-notes

Related

custom svg not displaying properly in fluttericon

I am trying to create custom icons (so svgs) in Adobe Illustrator for flutter so I am trying to load svg files into fluttericon. However, once I upload the svg file to fluttericon it only shows an outline and the actual symbol is not showing.
In Illustrator, I tried to Saves as SVG, Export as SVG and Exports for Screens -> SVG but none of them seem to work.
Am I missing something? If I upload another svg I got online it works perfectly fine.
I figured it out: In Illustrator, you need to turn the shapes into a compound path first and then export as svg (Object -> Compound path -> make). That way it shows up fine in fluttericon.
fluttericon has a good explanation for that as well: https://github.com/fontello/fontello/wiki/How-to-use-custom-images#importing-svg-images

Load image to framework

Good day,
I've been working with my custom framework in Swift. I'd like to add an image to my framework, but it doesn't have the Assets.xcassets folder to load the image.
Does anybody know how to do this?
In Xcode choose File > New File > Asset Catalog. The dialog looks like this:

How to display GIF in app?

i am trying to load gif in my project as per my requirement to show animation,
i have used third-party lib for showing gif animation,
i have copied same code from demo project but not working in my project.
Here is my code :
let animatedGif = UIImage.gif(name: "loading")
As #Patrick suggested, you have to replace your image path from asset folder and move it in your app’s bundle. This issue is also raised in its official git library’s issue tab. https://github.com/bahlo/SwiftGif/issues/67.

JavaFX 2.2 generated image not shown after building jar-file

In my JavaFX Application I generate a barcode with barcode4j by Apache, save it as png image in the directory /data/images/ and embed it in a web page which is shown on a JavaFX WebView.
After generating the barcode I embend it into the webpage using the following Javascript-Code:
path = "file:/" + path.replace(/\\/gi,"/");
var barcodeElement = document.getElementById("productBarcode");
barcodeElement.setAttribute("src", path );
barcodeElement.style.display = "inline-block";
I use the absolute path C:\path\to\java-program\data\myimage.png and build a file-URL from it.
Using this in Eclipse works without any problems. But when I build my project and start it from my jar-file the image is not shown. But the problem is not, that the path is incorrect or that generating the picture does not work, so that there is some kind of "not found" error. The place where the image should be is just white with a light border around.
And now the strangest part: If you right click on the image and choose "open in new window" the image is shown!
Does someone has an idea about that?
Thank you very much in advance!
My understanding is that the WebView won't let a page loaded with one protocol access files using another one. This makes perfect sense when you load through http://, and forbid file://. Here, you're loading through jar:file:..., and the webview will only let you access jar:file:... resources (I just tried, I can access an image from another jar file, from the same jar file, but not from outside!).
This sounds very much like a bug to me.
One workaround mentioned here is to use "data:" URI (i.e. encode the image directly in the HTML file).

iphone webview show html with images and css file

I found some interesting URL http://cubiq.org/rotating-wheel-for-your-iphone-webapps which has rotational menu. Its good. It has html file along with images, css files etc.
In iPhone app, I copied (to root folder) all the files and imported to project. I'm using UIWebView's load request to load the html. But I'm not getting the rotatable menu.
Can some one post me the code (or tutorial or prototype or example) on how to use it?
Also let me know how to catch the even on click on "OK" button at the middle of the html.
Thanks in advance.
checkout IUI : http://code.google.com/p/iui/