swift3의 스토리 보드를 통해 uitableview를 길게 누르는 중입니다. 스토리 보드에 하나의 프로토 타입 셀 세트 만 있습니다. 그러나 문제는 첫 번째 셀에서만 긴 누름이 감지되고 있다는 것입니다. 세포의 나머지 부분은 길게 눌러 제스처를 듣지 않습니다. 콘솔에 표시된테이블 뷰 셀에서 UILongPressGestureRecognizer를 사용하는 중
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 10
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
let row = indexPath.row
cell.textLabel?.text = "Label"
return cell
}
@IBAction func longPress(_ guesture: UILongPressGestureRecognizer) {
if guesture.state == UIGestureRecognizerState.began {
print("Long Press")
}
}
경고는 다음과 같습니다이 허용되지 않았다, 지금 적용됩니다
한 번에. iOS 9.0부터는로드 된 첫 번째보기에 배치됩니다.
제스처를 첨부 한보기는 무엇입니까? –
uitableview cell –
전체 tabelview에 longpressgesture를 추가하십시오. –