我正在使用 iPhone 应用程序中的 UIPickerview 控件。我想检测 UIPickerView 的选择指示器上的触摸。请帮助我。现在我正在使用以下代码
UITapGestureRecognizer *gestureRecognizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(pickerViewTapGestureRecognized:)];
[self.picker addGestureRecognizer:gestureRecognizer];
-(void)pickerViewTapGestureRecognized:(UITapGestureRecognizer *)gestureRecognizer
{
CGPoint touchpoint = [gestureRecognizer locationInView:gestureRecognizer.view.superview];
CGRect frame = self.picker.frame;
CGRect selectorFrame = CGRectInset(frame, 0.0, self.picker.bounds.size.height * 0.85/2.0);
if (CGRectContainsPoint(selectorFrame, touchpoint)) {
}
}