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 替换为另一个(具有相同的 Touch 事件逻辑)之后,第二个不会拾取任何触摸事件吗?
我正在使用以下方法替换它们:
[currentView removeFromSuperview]; NewView *newView = [[NewView alloc] init]; [窗口添加子视图:新视图];
感谢大家的帮助 :)
您的NewView班级是否首先设置为接收触摸事件?(在 Interface Builder 中设置的“启用用户交互”复选框,或者,userInteractionEnabled BOOL property设置为YES)UIView?
NewView
userInteractionEnabled
BOOL
property
YES
UIView
您的视图层次结构中的UIView下方NewView(即 的子级NewView)是否在方法中使用触摸事件touchesBegan:withEvent:?
touchesBegan:withEvent: