I have a UIPickerView
and The method didSelectRow
is not called when tapping on a selected row. I need to handle
Add a tapGestureRecognizer to the pickerView as already suggested
Provide views for the picker rows, not the title, via
-(UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
In the gesture's callback method do this
-(void)pickerTapped:(UIGestureRecognizer *)gestureRecognizer {
UIPickerView * pv = (id)gestureRecognizer.view;
UIView * selView = [pv viewForRow:[pv selectedRowInComponent:0]
forComponent:0];
CGPoint touchPoint = [gestureRecognizer locationInView:selView];
BOOL tapOnSelection = CGRectContainsPoint(selView.bounds, touchPoint);
if (tapOnSelection) ...
}
I think is more elegant then doing pixel math