Newbie question here:
I'm fiddling around with titanium studio with alloy mvc and starting to get the hang of it. It's just not clear to me how I can import a widget into my project.
I found a nice slider menu and want to use this in my own project.
Now the docs say you have to add a dependency in the config.json like so:
"dependencies": {
"com.slider" : "1.0"
}
and then you'd be able to use it in your view:
<Widget src="com.slider"></Widget>
But don't I need to import it into my project first? And if so, how? Importing it as a project only adds it to my workspace, not in my project user /widgets/slider
Upon building this I also get the following error:
config.json references non-existent widgets: ["com.slider"]
I've been looking for hours already on google but there's not much info on this besides the alloy docs that don't cover the importing thing.
Help?
Allright, so first thing you need to do is IMPORT the widget into your project.
If you take a look at the structure of an alloy project you should see in the app folder another folder called "widgets". Copy and Paste the widget inside of it, something like this (the folder name is different because I use another slider):
Then in your view (let's say you have a main view for the slider with a window in it):
<Window id="mainWindow" class="container">
<Require type="widget" src="com.slider" id="ds"/>
</Window>
Finally, in your config.json:
"dependencies": {
"com.slider":"1.0"
}
}
gitt.io is also great for finding and installing titanium widgets and modules
CLI installation: http://gitt.io/cli
来源:https://stackoverflow.com/questions/21525917/how-to-import-a-widget-in-alloy-titanium