0

I have a UITextField and UIButton in UIScrollView.I want to resign keyboard when user touches outside of UITextField. If i implement UITapGestureRecognizer then button does not work.any help will be appreciated.thanks in advance

DipakSonara
  • 2,598
  • 3
  • 29
  • 34

1 Answers1

0

try this..

-(void)viewWillAppear:(BOOL)animated{
    UITapGestureRecognizer *tapScroll = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapped)];
    tapScroll.cancelsTouchesInView = NO;
    [self.scrollView addGestureRecognizer:tapScroll];
}
- (void) tapped {
    [self.view endEditing:YES];
}
karthikeyan
  • 3,821
  • 3
  • 22
  • 45