How to debug who is eating my touches in UIKit?

前端 未结 7 1603
孤街浪徒
孤街浪徒 2021-01-30 17:16

I can\'t figure out why tapping on text fields and buttons in my view is not working. I\'ve checked all the obvious things like whether userInteractionEnabled is set to YES, whe

7条回答
  •  独厮守ぢ
    2021-01-30 17:27

    Not a direct answer to the question, but a very common cause of vanishing touches is for a control to be in a uiview which has a smaller size than that control, but is not clipping its bounds, so you won't see that the parent view is smaller (or even possibly zero-sized).

    Parent UIView size=0x0, clipToBounds=false
    
       Child UIButton size=100x50
    

    => Child Button won't get any touch events.

提交回复
热议问题