[英]UIPageViewController with UITableView, swipe to remove cells?
I have a UIViewController
with an UITableView
, and the UIViewController
resides in a UIPageViewController
. 我有一个
UIViewController
具有UITableView
和UIViewController
驻留在UIPageViewController
。 In fact, I have a bunch of these residing in the UIPageViewController
, and I swipe in order to see the next/previous UIViewController
which is all working as intended. 实际上,我有一堆驻留在
UIPageViewController
,然后滑动以查看下一个/上一个UIViewController
,它们都按预期工作。 However, I also need to be able to remove the UITableViewCell's
in the UITableView
by swiping, and it seems that the UIPageViewController
takes complete precedence over the swipe, making it impossible for me to remove my cells. 但是,我还需要能够通过滑动来删除
UITableViewCell's
中的UITableView
,并且似乎UIPageViewController
优先于滑动,这使我无法删除单元格。
How do I solve this? 我该如何解决? I assume there is not easy straightforward way, since there never is, so any suggestions?
我认为没有简单易行的方法,因为从来没有,所以有什么建议吗? If you're posting code please do so in Swift, thanks in advance!
如果您要发布代码,请在Swift中进行,谢谢!
You won't be able to make the left swipe do two things. 您将无法使左滑动做两件事。
The best solution would be to create an edit button that makes delete buttons appear next to your cells, like this: 最好的解决方案是创建一个编辑按钮,使删除按钮显示在您的单元格旁边,如下所示:
The edit transforms into "Done" when tapped to remove the "delete mode". 点击以删除“删除模式”时,编辑将转换为“完成”。
An alternate way to do this would be to create a specific zone on your screen where the left swipe brings another VC, so you can use the rest of your screen to use left swipe on your elements to delete them. 另一种执行此操作的方法是在屏幕上创建一个特定区域,向左滑动会带来另一个VC,因此您可以使用屏幕的其余部分对元素进行向左滑动来删除它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.