1

While running my app the buttons are acting strange. Instead of click they react only on swipe. They do get blue on clicking, but no action occurs, and if i swipe them they act as they should. On emulator everything works as predicted by clicking. I haven't implemented any methods for swiping buttons or etc. What could be the problem ?

UPDATED :

 forControlEvents:UIControlEventTouchUpInside];
[save addTarget:self action:@selector(saveInfo)


forControlEvents:UIControlEventTouchUpInside];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]
                               initWithTarget:self
                               action:@selector(dismissKeyboard)];
[TableControll.view addGestureRecognizer:tap];


-(void)dismissKeyboard {
    [[_textFields objectAtIndex:0] resignFirstResponder];
    [[_textFields objectAtIndex:1] resignFirstResponder];
    [[_textFields objectAtIndex:2] resignFirstResponder];
    [[_textFields objectAtIndex:3] resignFirstResponder];
}

Without dismiss keyboard the buttons work fine, so how should i make them work together without issues ?

Datenshi
  • 1,191
  • 5
  • 18
  • 56

2 Answers2

1
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer 
       shouldReceiveTouch:(UITouch *)touch {

    if ([touch.view isKindOfClass:[UIButton class]]) {
        return NO;
    }
    return YES;
}

Use this method for differentiate the tap event and button Event...

Nookaraju
  • 1,668
  • 13
  • 24
0

I had a similar problem and this was my solution:

tapRecognizer.cancelsTouchesInView = false
hoiberg
  • 361
  • 3
  • 5