I have the following piece of code that I'm expecting to run on a touch event:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch;
touch=[touches anyObject];
CGPoint point=[touch locationInView:self.view];
if (CGRectContainsPoint([billTotal frame],point))
{
[self pickerShow];
}
}
Its not being executed, any ideas what I'm doing wrong?
Regards, Stephen
Did you enable touches on the view?
I believe UIImageView
has user interaction disabled by default.
If you have a .xib file for the view you can enable touches in Interface Builder by selecting the view, pressing CMD + 1
and checking User Interaction Enabled
In code you can do it like this
myView.userInteractionEnabled = YES;