iPhone keyboard wont show up after adding uitextfield.inputView

390 views Asked by At

I have a signup page with a bunch of textfields. For some of them i replaced the textfields inputView with a UIPickerView to give them a selection of options to chose from. After implementing this, i ran into a strange problem. After the keyboard or pickerview is collapsed, (touching the background view ends editing) the keyboard (or pickerview) no longer shows up. It seems to just not pop up anymore. Possibly related... the cursor that flashes in the textfield no longer appears either.

The reason I know that the textfield is "Active" or recognizes that its editing is that the View controller moves its self.view to allow each textfield to be in the middle (in case its absolute position is on the lower half of the screen). So the whole viewcontroller moves but there its just black under the self.view when it moves up. I can provide more code where nessesary, but I feel this question may be more conceptual.

// Add picker
    picker = UIPickerView();
    picker.frame = CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: Globals.keyboardHeight())
    picker.dataSource = self;
    picker.delegate = self;
    ethnicityTextfield.inputView = picker;
    genderTextfield.inputView = picker;
    eyeColorTextfield.inputView = picker;
    hairColorTextfield.inputView = picker;
    heightTextfield.inputView = picker;
1

There are 1 answers

0
MingMan On

So I found the problem and Actually it had nothing to do with the inputViews. I had named a variable on the same view controller "firstResponder" and that apparently is a restricted term. The syntax highlighting and error detection doesnt mark it though so it took a while to find. I hope this helps someone else