我有一个视图和一个子视图。 在子视图中有一些可用的手势识别器。 它们都是在创建子视图时正常添加的,例如:
let assetViewTapGesture = UITapGestureRecognizer(target: self,action: #selector(self.handleAssetViewTap(_:)))
assetViewTapGesture.delegate = self
assetView.addGestureRecognizer(assetViewTapGesture)
在超级视图中,我有一个 UIPinchGestureRecognizer,它调用子视图中的一个函数,它反过来改变子视图中帧的大小:
public func scale(newWidth:CGFloat){
let factor:CGFloat = newWidth / self.internalAssetView.frame.width
self.internalAssetView.frame = CGRect(x: self.internalAssetView.frame.origin.x,y: self.internalAssetView.frame.origin.y,width: newWidth,height: self.internalAssetView.frame.height)
self.frame = CGRect(x: self.frame.origin.x,y: self.frame.origin.y,width: newWidth + additionParameter,height: self.frame.height)
}
当我捏合时,一切都很好,并且视图会以应有的方式改变它们的大小。
问题: 捏合结束后,我点击以在子视图内触发 TapGestureRecognizer。它正在发射,但仅在几秒钟后。实际上 - 我捏视图越多,我在点击屏幕和识别器实际触发之间等待的时间就越长。为什么更改视图的帧会影响手势识别器触发的延迟?