菜鸟教程小白 发表于 2022-12-11 17:04:58

iOS swift : Swipe table cell to perform action (not reveal)


                                            <p><p>最近我一直在使用 Google 的收件箱应用,发现滑动标记完成/暂停功能非常简洁实用。由于我正在开发一个具有类似 tableview 界面的应用程序,因此我一直在寻找在 iOS 中实现此功能的方法,但我没有找到任何东西。我得到的最接近的方法是滑动以显示额外的操作(如在 iOS 邮件应用程序中所见),但这需要同时滑动和单击按钮,这相当笨拙。有没有办法将 Action 绑定(bind)到滑动本身,而不是让它显示一些按钮?</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>您可以通过实现该方法来实现这一目标</p>

<pre><code> func tableView(_ tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -&gt; Bool
</code></pre>

<p>在您的委托(delegate)中,以 false 响应并在调用该函数时执行该功能</p></p>
                                   
                                                <p style="font-size: 20px;">关于iOSswift: Swipe table cell to perform action (not reveal),我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/38536175/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/38536175/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: iOS swift : Swipe table cell to perform action (not reveal)