Hi, I am using a scrollableview for the first time in ages and it seems that titanium now really aggressively clears images and memory to avoid crashes (which is great I guess) but it seems almost too aggressive.
My issue: I cannot get my second page in the view to display on the initial scroll... if I continue to use the app and then come back to the second page it will load, but the initial transition to it always results in a blank page. ive added code to the scroll function, ive added a touch listener to the first page, played around with 'cacheSize' but nothing works. Not sure if this is important but I am using 1600x1200 background images that range between 0.7 and 2mb on an ipad4
any thoughts? Thanks
2 Answers
Thanks Malcolm,
the code is very basic:
for (i=0; i < 28;i++) { pages[i] = Titanium.UI.createView({ width:"100%",height:"100%", backgroundImage:'images/page' + i + 'Bg.png'}); } var test = Ti.UI.createScrollableView({ views:[], horizontalBounce:false, showPagingControl:false, bottom:0, height:'100%', width:'100%', cacheSize:3, }); win.add(test); //add views to scrollable for (var s=0; s<pages.length; s++){ test.addView(pages[s]); }
Hi
I cannot test your code until the morning as I am not near my dev machine and gone midnight here - but thought I would throw something your way to try until I can.
function addPage(obj) { var view = Ti.UI.createScrollView({ width: Ti.UI.FILL, height: Ti.UI.FILL }); var img = Ti.UI.createImageView({ image: obj.image, width: Ti.UI.SIZE, height: Ti.UI.SIZE }); view.add(img); return view; } var pages = [], i = 0; for (i=0; i < 28; i++) { pages.push(addPage({ image: 'images/page' + i + 'Bg.png' })); } var test = Ti.UI.createScrollableView({ views:pages, horizontalBounce:false, showPagingControl:false, bottom:0, height: Ti.UI.FILL, width: Ti.UI.FILL, cacheSize:3 }); win.add(test);If this works then you can build on the scrollView to include zoom related properties. If let add a comment with any differences between this and your and I will test this and your in the morning.
Your Answer
Think you can help? Login to answer this question!