Question

I have a UITextfield dedicated to dates. When clicked I have a method that shows a UIView with a UIDatePicker as a subview and a method to hide it again. By default this UIView is hidden.

I've noticed that the textfields of my form are no longer clickable. However my UIButtons are still working.

The UIView is a subview of the superview that the UITextFields and UIButtons are also part of. The UIView also takes up the whole area of the window.

The UIView is an outlet also.

Does anyone have any idea what is happening here?

Kind regard

Code:

- (void) hidePickerView {
    [UIView animateWithDuration:0.5
                     animations:^{
                         [[self datePickerView] setFrame:CGRectMake(0, -250, 320, 50)];
                     } completion:^(BOOL finished) {
                         [[self datePickerView] removeFromSuperview];
                     }];
}

I've also tried putting the following in my viewDidLoad method:

[[self datePickerView] removeFromSuperview];
Was it helpful?

Solution

I was returning NO in my - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField method. Setting this to yes solved the problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top