Reputation: 1
How can I display images from a JSON sub-array which is received via my API? I can display the title, the price and the description but not the actual image. Can anyone give me a tip?
Upvotes: 0
Views: 812
Reputation: 3866
If you just need to display one image, use a dataTransform
attribute where you also have the dataCollection
attribute (see https://appcelerator.github.io/appc-docs/latest/#!/guide/Alloy_Data_Binding-section-36739592_AlloyDataBinding-Collection-ViewBinding) to select/compose the image URI from the JSON and then use the property in <ImageView image="{myImage}" />
Upvotes: 1
Reputation: 4055
You need to loop through the image array and create the ImageView inside JS. To display the images you can use a ScrollableView (http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.ScrollableView) and add the images as a view.
Upvotes: 0