Appcelerator TableViewRow 滑动
有谁知道允许在 tableviewrow 上左右滑动的 hack。默认的滑动操作会打开一个删除按钮,但是我需要其他按钮,但希望保持相同的用户体验,但“滑动”事件侦听器似乎不会在行上触发。
myTblRow.addEventListener('swipe', function(e){
Titanium.API.info("huzzah, a row was swiped");
});
以上==没有骰子。
Does anyone know of a hack to allow for a left->right swipe on a tableviewrow. The default swipe action opens a delete button however I require additional buttons but want to maintain the same UX but the "swipe" event listener doesn't seem to fire on rows.
myTblRow.addEventListener('swipe', function(e){
Titanium.API.info("huzzah, a row was swiped");
});
The above == no dice.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它确实需要一些技巧..删除 tableView 声明上的可编辑属性。
技巧是应用一个覆盖 tableRow 的视图:
注意 zIndex,不透明度使其存在但完全透明。
现在,您需要创建一个“滑动”事件侦听器:
当事件触发时,将调用 createUpdateRow(),它会返回一个 tableRow。您将所有自定义按钮添加到此 tableRow,您可以更改行的高度,任何内容。动画样式属性将意味着如果您从右侧滑动> >向左,新行将从左侧开始动画,这是我喜欢的效果..
希望这对其他人有帮助..额外的视图(row1)是我多年来的动力!
It does require a bit of a hack.. remove the editable property on the tableView declaration.
The hack is to apply a view that covers the tableRow:
Notice the zIndex, the opacity makes it exist but be totally transparent.
You now need to create a 'swipe' event listener:
When the event fires, createUpdateRow() is called, which returns a tableRow. This tableRow you add all of your custom buttons to, you can change the height of the row, anything. The animation style property will mean if you swipe from the right > left, the new row will animate in from the left, which is an effect I like..
Hope this helps, anyone else.. The extra View (row1) is what got me for ages!