Question

I have created an array, and stored my ImageViews in there, I then try to add it to the scrollableView, but titanium complains that it is an array object being passed into it.

How can I achieve this, thanks

} else {

var viewArr = [];


                                var view = Titanium.UI.createImageView({

                            width : 320,

                            height : 310,

                            //top: 10

                        }); 



                            view.image = ImageFactory.imageAsCropped(this.responseData, {

                                width : (width - 1),

                                height : (width - 1),

                                x : 60,

                                y : 0

                            });



                            viewArr.push(view);



                        }



                    }

                }, function(err) {

                    alert('error downloading image');

                });

            }



    //end



    }



}



$.scrollableView.addView(viewArr);
Was it helpful?

Solution

If you want to add an array of views to a scrollableView you can do one of the following

// 1.
$.scrollableView.views = viewArr;

// 2.
$.scrollableView.setViews(viewArr);

addView is for adding one view at a time.


Further details can be found in the Appcelerator docs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top