Open ravinashreddy opened 5 years ago
I tried your case with titleLabel
, which works fine.
Could you try it again? Is it might be your UIImageView
problem?
I will try but I need many clicks in a row. I need row selection as well as button selections so that I trigger then separately. Will let u know. I will try with label once.
if it is the image problem like u said, how to solve it. I need the image in the place. Can't get rid of it.
I just tried
func setupBasic() {
self.clipsToBounds = true
layer.shadowColor = UIColor.black.cgColor
layer.shadowOffset = CGSize(width: 0, height: 4)
layer.shadowRadius = 5
layer.shadowOpacity = 0
let bgColor = UIColor.green
self.titleLabel.setContentOffset(CGPoint.zero, animated: false)
titleLabel.font = UIFont.systemFont(ofSize: 14, weight: .medium)
titleLabel.backgroundColor = bgColor.withAlphaComponent(0.7)
let tgr = UITapGestureRecognizer(target: self, action: #selector(onFavClicked))
titleLabel.isUserInteractionEnabled = true
titleLabel.addGestureRecognizer(tgr)
}
but it is still triggering didSeelct method. Could anyone help with this?
I am debugging view hierarchy and noticed that titleLabel is behind contentView So I did
titleLabel.isUserInteractionEnabled = true titleLabel.addGestureRecognizer(tgr) contentView.bringSubviewToFront(titleLabel)
but it still does not click the label
Note: titleLabel is actually textview
Hi, This is really useful library. I am trying to customize the cell. So I created my own type of cell called CustomEventCell and registered in LongPressWeekView.
Inside this cell, I have label and an images( ex: favorite icon). I need to trigger some action when I click on this icon. But when I click the image/anywhere, collectionview's didSelect method is called.
How to trigger action/method/delegate when I click on image.
Here is my code for the cell
`class CustomEventCell: JZLongPressEventCell {
}
`