var _buttons : NSMutableArray = []
override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
let location : CGPoint = gestureRecognizer.location(in: self)
for subviews : UIView in _buttons {
if subviews.frame.contains(location) {
return false
}
}
return true
}
我这样做,但它有一个错误'NSFastEnumerationIterator.Element' (aka 'Any') is not convertible to 'UIView'
迅速跑环“NSFastEnumerationIterator.Element”(又名“任意”)是无法转换为“的UIView”
我试图取代for subviews : UIView in _buttons
到for subviews : UIView in _buttons as [AnyObject]
但不起作用。
我该如何继续?
什么是'buttons'?什么数组? –
请在设置按钮阵列时显示代码 –
是的,_buttons是一个可变数组 – roronoa