I am using a UIView
as a container to hold a UILabel
and an UIImageView
.
I want both the UILabel
and UIImageView
to have a UITapRecognizer
BUT: The Different functions.
let gesture3 = UITapGestureRecognizer(target: self,
action: #selector(chatViewController.clickOnGroupImage(_:)))
imageView.addGestureRecognizer(gesture3)
let gesture2 = UITapGestureRecognizer(target: self,
action: #selector(chatViewController.clickOnButton(_:)))
labelView.addGestureRecognizer(gesture2)
Now after putting both as subviews to my container, I am not able to click them (It worked fine, when I tested both methods just on a single Container).
Any Ideas?
确保userInteractionEnabled
是true
对你所申请的手势(意见imageView
, labelView
你的情况),也使集装箱的用户交互。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.