我的 UIViewController 中有一个 UIScrollView。我需要检测任何形式的触摸,然后做点什么。我还需要什么?
- (BOOL)canBecomeFirstResponder {
return YES;
}
- (void)viewDidAppearBOOL)animated {
[super viewDidAppear:animated];
[self becomeFirstResponder];
}
-(void)touchesBeganNSSet *)touches withEventUIEvent *)event
{
NSLog(@"TOUCHED"); // never happens
for (UITouch *touch in touches) {
if ( [touch view] == self.myScrollView)
{
//do something
}
}
}
两个选择:
关于ios - UIViewController 没有收到 touchesBegan 消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10793809/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |