Reputation: 13085
I have a UIScrollView in my UIViewController. I need to detect ANY kind of touch on it, and then do something. What else do I need?
- (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
}
}
}
Upvotes: 2
Views: 11420
Reputation: 2520
use a controller to set the UserInteractionEnabled
property to true
on a UIView
class.
try imgTouchMe.UserInteractionEnabled = true;
or follow
Upvotes: -1
Reputation: 5520
Two choices:
Upvotes: 3