我的 UIViewController 中有一个 UIScrollView。我需要检测任何形式的触摸,然后做点什么。我还需要什么?
- (BOOL)canBecomeFirstResponder {
return YES;
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[self becomeFirstResponder];
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
NSLog(@"TOUCHED"); // never happens
for (UITouch *touch in touches) {
if ( [touch view] == self.myScrollView)
{
//do something
}
}
}