Сокрытие / Показ UIPickerView

У меня Есть touchesEnded событие, которое проверяет на то, когда UITextField нажимается. То, что я хотел бы, чтобы это сделало, скрываются/показывают UIPickerView. Как это может быть сделано?

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
    UITouch *touch = [[event allTouches] anyObject];
    if (CGRectContainsPoint([self.textField frame], [touch locationInView:self.view]))
    {
        NSString * error = @"Touched the TextField";
        UIAlertView * errorAlert = [[UIAlertView alloc] initWithTitle:@"Selection!" message:error delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [errorAlert show];
        //Want to show or hide UIPickerView
    }
}

У меня уже есть выделенный UIPickerView, когда касания происходят

@interface ThirdViewController : UIViewController <UITextFieldDelegate,UIPickerViewDelegate> {
    IBOutlet UIPickerView *pickerView;
}
19
задан beryllium 11 May 2017 в 17:18
поделиться