以下のようにextensionを使うか、サブクラスを作ることでUIButton上でもtouchesBeganが呼ばれるようにしてSet<UITouch>からmajorRadiusが取得できると思います。
以下、参考にさせて頂いたURLでUIScrollView上なんかでも同様の問題が起きるようなので同じように対処してみました。
https://qiita.com/Ryosuke-Hujisawa/items/193d9f82bea2d3450a76
swift
1class ViewController: UIViewController {
2
3 override func viewDidLoad() {
4 super.viewDidLoad()
5
6 let btn = UIButton(frame:CGRect(x:100, y:100, width:100, height: 100))
7 btn.backgroundColor = .blue
8 view.addSubview(btn)
9 }
10
11 override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
12 for touch in touches {
13 let location = touch.location(in: self.view)
14 let radius = touch.majorRadius
15
16 print(radius)
17 print(location)
18 }
19 }
20}
21
22extension UIButton {
23 override open func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
24 super.touchesBegan(touches, with: event)
25 self.next?.touchesBegan(touches, with: event)
26 }
27}
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/07/20 04:00
2018/07/20 04:18
2018/07/20 04:48
2018/07/20 05:38
2018/07/20 09:08