我在UITextField
中有一个UIButton
和UIScrollView
。我想在用户触摸UITextField
之外时调用键盘。如果我实现UITapGestureRecognizer
,那么按钮不起作用。任何帮助将不胜感激。谢谢提前
答案 0 :(得分:0)
试试这个..
-(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];
}