我正在使用XLPagerTabStrip在页面之间滑动。其中一个页面有一个表视图。我正在尝试在这个表视图上实现swipe to delete,但DELET按钮只是在滑动时才会时不时地显示出来。
这是我的代码:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
if ([storiesArray count] >= 1) {
// code to delete row
}
}
}
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"I am allowing a swipe");
// Return YES if you want the specified item to be editable.
return YES;
}我可以看到删除I am allowing to swipe,所以我知道已经检测到了滑动,但我只能偶尔看到删除按钮。我找不到它没有显示删除按钮的原因。我已经搜索了关于这方面的每一篇文章,并询问了xmartlabs实现他们的代码是否会影响卷帘删除,但它偶尔会起作用是没有意义的。
有谁知道我还能做些什么来理解为什么delete按钮不总是显示?
谢谢。
发布于 2016-12-19 20:20:03
您可以禁用XLPagerTabStrip的containerView上的滚动,这样滚动将由内部视图处理。
也有一个类似的question给出了答案。
https://stackoverflow.com/questions/41221930
复制相似问题