Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23836] iOS10: Support UITableView data-source prefetching

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2016-08-30T07:22:58.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.1.0
ComponentsiOS
Labelsios10, prefetching, tableview
ReporterHans Knöchel
AssigneeHans Knöchel
Created2016-08-29T21:24:28.000+0000
Updated2016-11-28T21:53:13.000+0000

Description

iOS 10 offers a new way to prefetch items before they are visible in the actual visible area. This allows the developer to be notified when items are fetched so he/she can react on that beforehand (e.g. for preloading images already). {quote} The indexPaths are ordered ascending by geometric distance from the table view {quote} Along with that, the user can also be notified when items that previously qualified for prefetching were not actually displayed. For both cases, we can expose them using the events prefetch and cancelprefetch.

Comments

  1. Hans Knöchel 2016-08-29

    PR: https://github.com/appcelerator/titanium_mobile/pull/8285 Demo:
       var win = Ti.UI.createWindow();
       var list = Ti.UI.createListView();
       var items = [];
       
       for (var i = 0; i < 200; i++) {
           items.push({
               properties: {
                   title: "Item " + i
               }
           });
       }
       
       list.setSections([Ti.UI.createListSection({items: items})]);
       
       list.addEventListener("prefetch", function(e) {
           Ti.API.warn("event:prefetch");
           Ti.API.warn(e.prefetchedItems);
       });
       
       list.addEventListener("cancelprefetch", function(e) {
           Ti.API.warn("event:cancelprefetch");
           Ti.API.warn(e.prefetchedItems);
       });
       
       win.add(list);
       win.open();
       
  2. Chee Kiat Ng 2016-08-30

    CR and FT passed. Scroll the list view to see the prefetch events.
  3. Samir Mohammed 2016-11-28

    Verified, was able to see the prefetch information in the console (Using the code provided above). Example of the information shown in the console can be seen below.
       [WARN] :   event:prefetch
       [WARN] :   (
       [WARN] :           {
       [WARN] :           itemIndex = 16;
       [WARN] :           section = "[object TiUIListSection]";
       [WARN] :           sectionIndex = 0;
       [WARN] :       },
       [WARN] :           {
       [WARN] :           itemIndex = 17;
       [WARN] :           section = "[object TiUIListSection]";
       [WARN] :           sectionIndex = 0;
       [WARN] :       },
       
    *Environment*
       Appcelerator Command-Line Interface, version 6.0.0
       Iphone 6S (IOS 10.0)
       Operating System Name: Mac OS X El Capitan
       Operating System Version: 10.11.6
       Node.js Version: 4.6.0
       npm: 4.2.8
       Titanium CLI Version: 5.0.10
       Titanium SDK Version: 6.1.0.v20161128031712
       Xcode: 8.0
       Appcelerator Studio: 4.8.0.201611121409
       

JSON Source