Question

I am working on an app where I have a UITableView that has a UITextField in each cell. The textfield is attached to each row via a custom cell. Because there is no number only keypad for the iPad, I have to implement my own (I don't have a choice here). I have created custom buttons for this keyboard inside MainStoryboard, attached these buttons to a view that serves as a custom inputView. These buttons all call the same method which should enter the value of the label on the button, into the textfield. Unfortunately, this is not working. I am implementing the UITextFieldDelegate method:

-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField{


    NSLog(@"how about here?");
    return YES;

}

which unfortunately does not get called when I place the cursor in any of the textfields, and not when I press any of the keys on the keypad, since I don't see any output on my xcode screen.

I attach the custom keypad to the inputView attribute of each textfield inside my "cellForRowAtIndexPath" method as follows:

_cell.textField.inputView = _inputView;

Can anyone see what I'm doing wrong? I figure implementing the UITextFieldDelegate would be the way to go to accomplish this (which to me appears to be very straight forward), but unfortunately I'm struggling with this. I have also included a screenshot if it helps.enter image description here

Thanks in advance to all who reply.

Was it helpful?

Solution

Make

textField.delegate = self

or

_cell.textField.delegate = self;

Hope this works !!!

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