Created
April 15, 2012 14:47
-
-
Save minhnc/2393239 to your computer and use it in GitHub Desktop.
ImageView with SVG
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win = Titanium.UI.createWindow({backgroundColor: 'white'}); | |
var img = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=='; | |
var index = img.indexOf('base64,'); | |
img = img.substring(index + 'base64,'.length); | |
Ti.API.info(img); | |
var imageView = Ti.UI.createImageView({ | |
image: Ti.Utils.base64decode(img), | |
width: 100, | |
height: 100 | |
}); | |
win.add(imageView); | |
win.open(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I used this to render an SVG image in a tableview. I get the following error:
The application has crashed with an uncaught exception 'NSInvalidArgumentException'
[ERROR] invalid image type. expected TiBlob, String, TiFile, was: TiBlob -TiUIImageView setImage_:
This is in Titanium 3.2