您无法使用 模拟滚动,headerPullView
但可以触发scroll
.
无论如何,我建议创建一个headerView
并将桌子高度设置为更小并远离顶部。将侦听器附加到open
事件。
var headerView = Ti.UI.createView({
top: 0,
height: 60
});
Ti.UI.currentWindow.addEventListener('open', function(e) {
tableView.top = 60;
tableView.height = 400;
Ti.UI.currentWindow.add(headerView);
Ti.UI.currentWindow.add(tableView);
});
然后,当您第一次滚动表格时,只需将其全部设置回您需要的方式。
var scrolled = 0;
tableView.addEventListener('scroll', function(e) {
if(!scrolled) {
tableView.top = 0;
tableView.height = 460;
Ti.UI.currentWindow.remove(headerView);
scrolled = 1;
}
// scroll code
});
但是,我不太确定您为什么需要这样做。在 facebook 用这种方法替换“摇动刷新”之后,我开始在几乎所有的桌面应用程序中看到它,并且开始期待它。我假设许多其他用户对此有同样的感受?