Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 UIView 子类,其中 hitTest: withEvent: 被覆盖。每次命中测试注册时,视图都会记录其标签。
例如:点击
控制台:您触摸视图:3 您触摸视图:3 您触摸视图:3
我的问题:为什么它会做三遍?我需要它来触发 NSLog 以外的东西,我担心它也会触发 3 次。我可以轻松解决三重触发问题,但我想知道是否有更好的解释。
我建议您记录事件信息以及 uiview 的标签。它可能被多个事件调用 - touchDown、touchUp 等。