我正在尝试创建UIControl的子类并跟踪触摸以更改控件外观。我不知道为什么,但是如果我从IB或代码中添加操作(对于.TouchUpInside),当我触摸控件时,注册操作方法会被调用两次。堆栈跟踪告诉我,第一个调用来自_sendActionsForEvents:withEvent:,第二个不清楚。下面是我如何覆盖跟踪方法:overridefunccontinueTrackingWithTouch(touch:UITouch,withEventevent:UIEvent?)->Bool{lettouchPoint=touch.locationInView(self)ifCGRectC