macOS, iOS

[iOS] long press touch 처리하기

SweetDev 2020. 7. 16. 17:14
class CommentTableViewCell: UITableViewCell {
  @IBOutlet var senderLabel: UILabel!
  @IBOutlet var timeLabel: UILabel!
  @IBOutlet var bodyLabel: UILabel!

  override func awakeFromNib() {
    super.awakeFromNib()
    // Initialization code
    let longPressRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(longPressed))
    self.contentView.addGestureRecognizer(longPressRecognizer)
  }
  @objc func longPressed(sender: UILongPressGestureRecognizer) {
    print("longpressed")
    
  }
}