ios - Titanium Lazy loading only when image view is visible -
i have 10 image views stacked on 1 another. (for loop)
9 of them set visible = false.
1 of them set visible = true.
i wondering if there way load image when imageview visibility set true. i.e. after image view removed off stack.
the problem having is loading images @ same time in stack, slowing down.
(var = 0; < peoplejson.users.length; i++) { //create containers store every kid object containers[i] = titanium.ui.createview({ id : 'container', visible : false, width : '100%', zindex : '0', }); imageswipeview[i] = titanium.ui.createimageview({ image : peoplejson.users[i].pictures[0], visible : true, containerobj : containers[i], containerobjprev : containers[temp], pictures : peoplejson.users[i].pictures, indimageview : indimageview[i], basket : labelbasket[temp], top : 0, zindex : 2, width : '100%', defaultimage : 'images/plainbg.png', height : 510, }); containers[i].add(imageswipeview[i]); win.add(containers[i]); if (i == (peoplejson.users.length - 1)) { //show lastly container when loop executed containers[i].visible = true; $.view_indicator.visible = false; } [..] this code snippet says stack containers ontop of 1 another, 1 time loop has executed show lastly container.
later on have onclick event each image view, if clicked, removes container @ top of stack , makes 1 underneath visible.
what trying , load imageview remote images when container becomes visible. right now, seek , load images visible or not visible.
you can seek setting path image different property:
imageswipeview[i] = titanium.ui.createimageview({ _image : peoplejson.users[i].pictures[0], ... }) and when setting visible = true update image property:
containers[i].visible = true; if (!imageswipeview[i].image) { imageswipeview[i].image = imageswipeview[i]._image; } $.view_indicator.visible = false; ios titanium lazy-loading
No comments:
Post a Comment