我将 UIPickerView 添加到滚动视图中。当我从 pickerview 中选择一行时,它会被隐藏并且我无法选择它,因为我已经编写了代码以在用户点击屏幕上的任何位置(scrollView)而不是 pickerView 时删除 pickerview。但现在甚至我点击(选择)pickerview 我隐藏了 gtng pickerview,因为触摸被检测为 ScrollView。我不明白我哪里出错了。
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
if(touch.view==testScroll)
{
if(UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPad)
{
ViewForValuePicker.hidden=true;//view to which pickerview is added and this s view is added to scrollview
pickerView.hidden=YES;
}
return YES;
}
else
return NO;
}
单击屏幕上的任何位置时,我可以做些什么来删除pickerview,并且在点击pickerview的行时不要删除它