UIButton의 실제 크기는 작지만 터치하기 불편할 수 있음.ExtendedButton은 터치 영역을 확장해서 사용자가 더 쉽게 누를 수class ExtendedButton: UIButton {
var touchAreaInset: CGFloat = -10
override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
let area = bounds.insetBy(dx: touchAreaInset, dy: touchAreaInset)
return area.contains(point)
}
}
touchAreaInset-10point(inside:with:)bounds 대신 확장된 영역을 터치 감지 범위로 사용.insetBy(dx:dy:)let button = ExtendedButton(type: .system)
button.setTitle("확장 버튼", for: .normal)
button.touchAreaInset = -20 // 터치 영역 20px 확장
20px 더 크게 적용됨.정리 - ExtendedButton은 작은 버튼을 누르기 쉽게 해주는
유틸리티. - touchAreaInset 값만 조정하면 유연하게 터치 영역 관리 가능.