Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-15095

iOS: ScrollableView's manageCache causing lag halfway through page

    Details

      Description

      When scrolling through the pages of a ScrollableView composed out of several 'heavy' views, a noticeable lag occurs halfway scrolling to the next page.

      Code to reproduce

      var color = 'red';
       
      function createView() {
          color = (color === 'red') ? 'green' : 'red';
          
          var v = Ti.UI.createView({backgroundColor:color,layout:'vertical'});
          
          var colorAlt = 'blue';
          
          for (var i = 0; i < 250; i++) {
              colorAlt = (colorAlt === 'blue') ? color : 'blue';
              v.add(Ti.UI.createView({backgroundColor: colorAlt, height: 5}));
          }
          
          return v;
      }
       
      var v = [];
       
      for (var i = 0; i < 10; i++) {
          v.push(createView());
      }
       
      var w = Ti.UI.createWindow({backgroundColor:'white', views: v});
      var s = Ti.UI.createScrollableView({views:v});
       
      w.add(s);
      w.open();
      

      Problem

      Me and Timan Rebel tracked down the problem and manageCache seems to be the problem. When the nextPage changes half-way, manageCache renders all views within range, instead of just the new view getting into the range. It must be possible to make this more efficient. But even if it's just 1 or 2 views that need to be rendered, if they are heavy, the lag still occurs.

      Solution

      We investigated if the rendering could possibly be delayed until after fully having slide to the next page, but then the lag occurs 1 or 2 pixels before reaching the next page and if you scroll through the pages fast, the rendering won't be triggerd at all. We didn't manage to find a satisfying solution, but I'm sure the Appcelerator iOS experts can

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vduggal Vishal Duggal (Inactive)
                Reporter:
                fokkezb Fokke Zandbergen
                Reviewer:
                Pedro Enrique (Inactive)
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-17377
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code