我有一个自定义类,上面有一个UIPanGestureRecognizer。它在我第一次移动时有效,但是放开后不会记录任何触摸事件。为什么平移手势只能一次执行一次,而不能再次执行?我正在使用Swift 5.1 这是我的代码:
public class FilterConfig
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
// ...
filters.Add(new OutputCacheAttribute
{
NoStore = true,
Duration = 0,
VaryByParam = "*",
Location = System.Web.UI.OutputCacheLocation.None
});
}
}
这是视图控制器:
class ToolPallet: UIView {
// MARK: - Instance Variables
let kCONTENT_XIB_NAME = "ToolPallet"
// MARK: - Outlets
@IBOutlet var contentView: UIView!
@IBOutlet weak var grabberView: UIView! { didSet { grabberView.layer.cornerRadius = grabberView.bounds.width / 2 } }
@IBOutlet weak var grabberImageView: UIImageView! { didSet { grabberImageView.layer.cornerRadius = grabberImageView.bounds.width / 2 } }
@IBOutlet weak var palletView: UIView!
// MARK: - Actions
// some basic IBActions here
// MARK: - Intialization
init(handed: Handed) {
super.init(frame: CGRect())
self.handed = handed
Bundle.main.loadNibNamed(kCONTENT_XIB_NAME, owner: self, options: nil)
self.autoresizingMask = [.flexibleWidth, .flexibleHeight]
self.addSubview(contentView)
translatesAutoresizingMaskIntoConstraints = true
self.frame = CGRect(x: 40, y: 142, width: 100, height: 481)
}
}