YPDrawSignatureView - 绘制签名时表格滚动

e4s*_*ood 4 scroll cell swift

所以我想要一个表格单元格中的签名视图。显然,每当有人试图在单元格中绘制时,表格就会滚动。

我将如何停止滚动,但仅当用户在签名框中书写时才停止?

har*_*ani 5

我为这个问题找到了更好的解决方案,而不是放置按钮。在 viewController 中实现委托方法,

class mainVC: UIViewController,YPSignatureDelegate {
Run Code Online (Sandbox Code Playgroud)

将签名视图的委托设置为此视图控制器

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
            let cell = tableView.dequeueReusableCell(withIdentifier: "SignatureCell", for: indexPath) as! SignatureCell
            cell.signatureView.delegate = self
            return cell
}
Run Code Online (Sandbox Code Playgroud)

然后添加这些代码。这是 YPSignature 的两个代表。在主视图控制器中添加

    func didStart() {
        tableView.isScrollEnabled = false
    }
    // didFinish() is called rigth after the last touch of a gesture is registered in the view.
    // Can be used to enabe scrolling in a scroll view if it has previous been disabled.
    func didFinish() {
        tableView.isScrollEnabled = true
    }
Run Code Online (Sandbox Code Playgroud)