[TIMOB-12618] iOS: Expose New iOS 6 API UIRefreshControl for TableView 'Pull to Refresh'
| GitHub Issue | n/a |
|---|---|
| Type | New Feature |
| Priority | High |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2013-10-22T20:00:22.000+0000 |
| Affected Version/s | Release 3.1.0 |
| Fix Version/s | 2013 Sprint 22, 2013 Sprint 22 API, Release 3.2.0 |
| Components | iOS |
| Labels | UIRefreshControl, module_listview, module_tableview, qe-closed-3.2.0, qe-testadded |
| Reporter | Slim McKinsley |
| Assignee | Vishal Duggal |
| Created | 2013-01-31T23:48:36.000+0000 |
| Updated | 2013-10-31T00:19:20.000+0000 |
Description
UIRefreshControl is a new API in iOS 6.0 to implement "pull to refresh" in the same way the native Apple Mail app does it. This is a feature request to add UIRefreshControl functionality to Titanium's TableView so pull to refresh can easily be implemented in the standard Apple way.
A Titanium implementation can be found at: https://github.com/k0sukey/TiExtendView/blob/master/Classes/TiUITableView%2BExtend.m
[~fokke] Thanks. We'll look at including this in an upcoming release.
All, in the context of the new iOS 7 refresh control, is there still a strong rationale to pursue this ticket?
Yes, because in iOS7 it's the exact same control, just different style. So any implementation would work for both iOS6 and iOS7.
I agree. Besides, it's too early to give up IOS 6. There is a lot of Iphone 3GS et Ipad 1 in the market et this users can't upgrade to IOS 7. It would be nice to have a consistent native UX between IOS 6 and 7
Test Case For List View
Test Case for TableViewvar win = Ti.UI.createWindow({ fullscreen:true }); var counter = 0; function genData() { var data = []; var i=1; for (i=1;i<=3;i++) { data.push({properties:{title:'ROW '+(counter+i)}}) } counter += 3; return data; } var section = Ti.UI.createListSection(); section.setItems(genData()); var listView = Ti.UI.createListView({ sections:[section] }); var control = Ti.UI.createRefreshControl({ tintColor:'red' }) listView.setRefreshControl(control); control.addEventListener('refreshstart',function(e){ Ti.API.info('refreshStart'); setTimeout(function(){ Ti.API.debug('Timeout'); section.appendItems(genData()); control.endRefreshing(); }, 2000); }) win.add(listView); win.open();var win = Ti.UI.createWindow({ fullscreen:true }); var counter = 0; function genData() { var section = Ti.UI.createTableViewSection({ headerTitle: 'Section '+counter }); section.add(Ti.UI.createTableViewRow({ title: 'Row 1' })); section.add(Ti.UI.createTableViewRow({ title: 'Row 2' })); counter = counter + 1; return section; } var tableView = Ti.UI.createTableView({ data:[genData()] }); var control = Ti.UI.createRefreshControl({ tintColor:'red' }) tableView.setRefreshControl(control); control.addEventListener('refreshstart',function(e){ Ti.API.info('refreshStart'); setTimeout(function(){ Ti.API.debug('Timeout'); tableView.appendSection(genData()) control.endRefreshing(); }, 2000); }) win.add(tableView); win.open();Pull pending against master https://github.com/appcelerator/titanium_mobile/pull/4818
Tested and verified "Pull to Refresh" with: Titanium Studio, build: 3.2.0.201310300119 Titanium SDK, build 3.2.0.v20131029150357 CLI 3.2.0 Xcode 5.0 iOs 6.0 simulator iPhone5s 7.0.2