Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS overlapped views and UIGestureRecognizer
    primarykey
    data
    text
    <p>I have a view with a <code>UIButton</code> inside like this: <a href="http://imageshack.us/a/img827/7240/screenshot20130220at333.png" rel="nofollow noreferrer">snapshot 01 http://imageshack.us/a/img827/7240/screenshot20130220at333.png</a></p> <p>The button is bound to an <code>IBAction</code>:</p> <pre><code>-(IBAction)deleteButtonPressed :(id)sender{ NSLog(@"DeleteButtonPressed"); } </code></pre> <p>I also have another view that shows a collection of the last view: <a href="http://img836.imageshack.us/img836/2104/screenshot20130220at339.png" rel="nofollow noreferrer">snapshot 02 http://img836.imageshack.us/img836/2104/screenshot20130220at339.png</a></p> <p>In the controller of this view, at some point I have this:</p> <pre><code> UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction:)]; tapGesture.numberOfTapsRequired = 1; tapGesture.numberOfTouchesRequired = 1; [preview addGestureRecognizer:tapGesture]; </code></pre> <p>And this:</p> <pre><code>- (void)tapAction:(UIGestureRecognizer *)gestureRecognizer{ EditorViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"EditorViewController"]; vc.narration = preview.narration; self.navigationItem.backBarButtonItem.style = UIBarButtonItemStylePlain; self.navigationItem.backBarButtonItem.title = @"Done"; vc.navigationItem.backBarButtonItem.style = UIBarButtonItemStylePlain; vc.navigationItem.backBarButtonItem.title = @"Done"; [self.navigationController pushViewController:vc animated:YES]; } </code></pre> <p>So, when I touch in the preview, I load another view. My problems come when I tap the button. In this case, the function <code>-(IBAction)deleteButtonPressed: (id)sender</code> doesn't get executed but the <code>tapAction</code> does. Also, the button change while is pressed. I tried to don't add the GestureRecognizer and then <code>-(IBAction)deleteButtonPressed :(id)sender</code> is executed.</p> <p>What I am doing wrong? How can I achieve that when tap on the button, the view underneath doesn't capture the gesture?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload