GeraudBourdin / Ti.SvgView

Create a view from an svg file (expose the androidsvg-1.2.1 lib and the SVGKit 2.X for IOS lib).
MIT License
50 stars 24 forks source link

Info, Labels and buttons icons property #3

Closed nuno closed 9 years ago

nuno commented 9 years ago

Hello @GeraudBourdin , I have a question: this can work for labels "icon" property? Or buttons "icons" etc?

if possible a example will'b great. :)

Thanks for this module.

GeraudBourdin commented 9 years ago

hi Nuno,

I didn't found icon property for labels nor buttons UI elements. May be you meant image property for button element, right ?

Unfortunately, svgView as the name says is a basic View not an image. As Button element need a string path or a blob you could simply do this like this :

Button id="buttonSvg" title="my beauty button :)" top="10" width="200" height="50" />

and in your controller file :

var imageButton = svgView.createView({ image: "android.svg", width: '50', height: '50', top: 0, left: 0, backgroundColor:'pink' }); var blob = imageButton.toImage().media; $.buttonSvg.setImage(blob);

i've just tried it, and it works. Don't know if it efficient enough but that a quick workaround. Did i answered your question ?

nuno commented 9 years ago

@GeraudBourdin My bad, yes that answer my question, I will do some tests.

Thank you very much for you quick answer :)

GeraudBourdin commented 9 years ago

I've just made a readme.md for a quick doc. And i added this answer to it. Hope this will help :) You're welcome, i am glad if this module can be used !