2

I'm using Interface Builder.

In my XIB file I have a UIView that I'm using as a "container" view to hold my UITextFields.

I have three UITextField in that UIView.

They are all wired up to an IBOutlet and the delegate for each is wired to the File's Owner.

Everything in Interface Builder has 'User Interaction Enabled' checked.

I can select, meaning click on to bring up the keyboard, the top two UITextFields.

When I click on the third (bottom) UITextField, nothing happens. The keyboard will not appear.

I can programmatically set it to becomeFirstResponder, but when I click on it via Simulator, or tap on it via device, nothing happens.

What could I be overlooking?

Luke Irvin
  • 1,179
  • 1
  • 20
  • 39
  • Delete that third UITextField and then just copy and paste one of the working UITextFields. – rocky May 10 '14 at 00:03
  • Did you check that all the textFields are inside the view, in the view hierarchy at the left of the editor, when the NIB is selected?. Also, have you tried to add additional textFields programatically? and then add them to the view with addSubview? – eharo2 May 10 '14 at 00:04
  • Yes, they are all placed correctly. I deleted the UITextField and copy/pasted one that works. It does work now, but the selection area is small. I have to tap near the top of the UITextField to bring up the keyboard. How do I fix this to click anywhere in the field? – Luke Irvin May 10 '14 at 00:07
  • I agree with @eharo2 - I'm guessing that because of auto layout the third text field is no longer inside the container UIView when the app runs. A subview not inside its superview is visible but untouchable. To prove this, set the UIView so that "clips to bounds" - if this causes the text field to vanish when the app runs, you've solved it. – matt May 10 '14 at 00:07
  • Not using auto layout, but I selected 'Clip Subviews' on the UIView and the last UITextField disappeared. – Luke Irvin May 10 '14 at 00:09
  • There you go. You need to fix your layout so that the last UITextField is not outside the bounds of its superview. Remember that the main view gets resized when the app runs and the nib loads, so what you see in Interface Builder is not what will really happen. (There is now a "preview mode" in IB to help you with this.) You have to design your layout to respond to this change in size. – matt May 10 '14 at 00:15

1 Answers1

0

Make sure that your third UITextField or given delegate connection in file owner's. and make sure that your third Textfield is inside your current view.

Gaurav Gilani
  • 1,584
  • 14
  • 18