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

前端 未结 9 1170
南方客
南方客 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:12

    answer of Lukas in swift and deselect highlighted

    extension UIButton {
    
      public override func pointInside(point: CGPoint, withEvent event: UIEvent?) -> Bool {
    
        var inside = super.pointInside(point, withEvent: event)
    
        if inside != highlighted && event?.type == .Touches {
            highlighted = inside
        }
    
        return inside
    
      }
    
    }
    

提交回复
热议问题