我的 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/
欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://jike.in/) | Powered by Discuz! X3.4 |