如何在我的班级中添加touchesBegan()方法?
这是我的方法:
<!doctype html>
<html lang="<?php echo e(app()->getLocale()); ?>">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Market</title>
</head>
<body>
<ul>
<?php
@foreach ($markets as $market) {
echo market.name;
<li>
<a href = {{ route('markets.show', $market) }}>
{{$market.name}}
</a>
</li>
}
?>
</ul>
</body>
答案 0 :(得分:1)
如果你的话,可以使用类扩展添加方法 class是UIView或UIWindow的子类:
extension YourClass {
override open func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesBegan(touches, with: event)
for touch in touches{
let locationUser = touch.location(in: self)
}
print("touchesBegan")
}
}