2

I have a view overlayed to the iPhone's camera view. In this view I have some uibuttons that are displayed in positions depending of values from accelerometer/compass. I need to fire an event when the user touch up inside the view but he doesn't touch up inside the uibuttons, I mean, the opposite action of touch up inside the uibuttons. Anyone knows a kind to do this? Thanks!

User97693321
  • 3,336
  • 7
  • 45
  • 69

3 Answers3

1

If you implement the UIResponder touchesBegan:withEvent: method..

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event

...on your view, you'll be able to tell when the user has pressed outside of the buttons.

See the UIResponder Class Reference for more information.

John Parker
  • 54,048
  • 11
  • 129
  • 129
0

you may e.g. assign one event handler (IBAction) to UiVeiw and its UIButtons and then compare sender parameter:

-(IBAction) viewClicked :(id) sender {
  if (id == myView) ...
}
heximal
  • 10,327
  • 5
  • 46
  • 69
0

I tried your options but it doesn't work. The view that I tried to fire the event was in a TabBar item in a camera view, so I think the responders chain doesn't work with it. Finally, I solved the problem doing the overlay view the first responder with:[viewOverlay.view becomeFirstResponder];