我有显示蒙版图像的简单代码。
@IBOutlet weak var mainImage: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
let maskView = UIImageView()
maskView.image = ... //mask image
maskView.frame = mainImage.bounds
mainImage.mask = maskView
mainImage.isUserInteractionEnabled = true
}
如何覆盖hitTest
以忽略遮罩(透明区域)之外的触摸?