scrollableview not displaying view - ti sdk:3.0.0GA -xcode 4.41 -iOS5.1

You must Login before you can answer or comment on any questions.

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

— asked 3 years ago by sean oreilly
1 Comment
  • Please provide some sample code that will help us either determine the problem due to a technique you have used, an unfortunate typo or any other reason.

    Right now I can tell you that I have created a scrollableView with 20 pages using images larger than yours embedded in views that allow zooming. I had no such issue that you are describing.

    — commented 3 years ago by Malcolm Hollingsworth

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({
//add views to scrollable
for (var s=0; s<pages.length; s++){


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
  return view;
var pages = [], i = 0;
for (i=0; i < 28; i++) {
    image: 'images/page' + i + 'Bg.png'
var test = Ti.UI.createScrollableView({
    height: Ti.UI.FILL,
    width: Ti.UI.FILL,
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.

— answered 3 years ago by Malcolm Hollingsworth
answer permalink
  • Thanks Malcolm, i really appreciate the time. Your solution worked, there's some stutter between some of the transitions between pages, is that par for the course or am i fudging something up elsewhere you think?

    — commented 3 years ago by sean oreilly

  • You are welcome, the iPad is not the quickest way to type code in! Glad it worked.

    As to the stuttering - this one comes down to "depends".

    It depends;

    • on the size of the images
    • how many images
    • the amount of memory available
    • any background tasks (system ones),
    • how many other apps you have in sleep mode,
    • what else is on the screen at the same time
    • any animations or transitions
    • the current cacheSize (sometimes bigger is better)
    • which device, thus how many pixels (you have the daddy of the iPads)

    If you are able and comfortable, zip the images up put them on a web server or file share and [DevLink] me an email with the link. I will try them here and report back.

    — commented 3 years ago by Malcolm Hollingsworth

  • Did this answer your question?

    — commented 3 years ago by Malcolm Hollingsworth

Your Answer

Think you can help? Login to answer this question!