UIButton fails to properly register touch in bottom region of iPhone screen

前端 未结 9 1172
南方客
南方客 2020-11-28 08:49

I have an app with many different buttons arranged in a calculator like, square / rectangular format. It is actually extremely similar to the default iOS calculator. There a

9条回答
  •  没有蜡笔的小新
    2020-11-28 09:23

    Swift 3 Solution

    extension UIControl {
    
        open override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
            let inside = super.point(inside: point, with: event)
            if inside != isHighlighted && event?.type == .touches {
                isHighlighted = inside
            }
            return inside
        }
    }
    

提交回复
热议问题