私は、2つのボタンとtableViewを持つダイアログをポップアップするボタンがあります。 tableViewはカスタムUIViewを使用して表示され、UITableViewCellもカスタムです。 UITableViewCellは、カスタムチェックボックスとUILabelで構成されています。テーブルビューにタップジェスチャーを追加しようとしています。その行をクリックすると、チェックボックスがマークされます。私はもっとして3秒間押すと、この機能は、ちょっと作品のが、UITableViewCellのは、このエラーの原因となっていただきました!私は知らないこのSwift UiTableViewCellメインのView Controllerで長押しの後にリセット
UITableViewCell Error ScreenShot
にリセットされます。どんな助けもありがとう。私はあなたがタップジェスチャーを追加する必要があるかもしれないと思う
override func viewDidLoad() {
super.viewDidLoad()
...code
let tap = UITapGestureRecognizer(target: self, action: #selector(tableTapped))
self.tableView.addGestureRecognizer(tap)
}
func tableTapped(tap:UITapGestureRecognizer) {
let location = tap.location(in: self.tableView)
let path = self.tableView.indexPathForRow(at: location)
if let indexPathForRow = path {
self.tableView(self.tableView, didSelectRowAt: indexPathForRow)
print("Tapped on the table")
} else {
// handle tap on empty space below existing rows however you want
}
}
どうすればいいですか? – satish99