Back

titanium 插件:下拉自动刷新(pull to refresh)

发布时间: 2015-01-11 01:38:00

refer to:  https://github.com/FokkeZB/nl.fokkezb.pullToRefresh

对于IOS:

Ios Pull

对于Android: 

Android Pull

使用方法:(参考官方文档)

1. Download and install the distribution 0.4.1 or later of Ivan's fork of Ti.SwipeRefreshLayout.

2. Install nl.fokkezb.pullToRefresh via gitTio:

$ gittio install nl.fokkezb.pullToRefresh

3. 为你的 <ListView> 或者 <TableView> 加个 Wrapper: (注意有个 onRelease 属性)

<Alloy>
  <Collection src="myCollection" />
    <Widget id="ptr" src="nl.fokkezb.pullToRefresh" onRelease="myRefresher">
      <ListView>
        <ListSection dataCollection="myCollection">
          <ListItem title="{title}" />
        </ListSection>
      </ListView>
    </Widget>
</Alloy>

4.  相关的方法

function myRefresher(e) {
    myCollection.fetch({
        success: e.hide,
        error: e.hide
    });
}

5. 使用:

$.ptr.refresh();

Back