T-Pham/UITextField-Navigation

UITextField.nextNavigationField = UITextView not working

Idomo opened this issue · 7 comments

Idomo commented

First thing, thanks for this library, the exact little addon that makes the life easier.
Unfortunately when I'm trying to do something like UITextField.nextNavigationField = UITextView, I don't get next arrow (it's disabled) so I can't go to the UITextView via the library's toolbar if I'm in UITextField.
Note that UITextField.nextNavigationField = UITextField working great so the problem is only when setting UITextField.nextNavigationField = UITextView.

Thanks,
Ido.

Idomo commented

*Note that it's working via the storyboard (if you drag UITextField to UITextView and check the nextNavigationField outlet).

@Idomo I can't produce the issue. Can you double check if the nextNavigationField property is assigned properly? The next button is disabled when the nextNavigationField property is nil.
You can also check if the example app on the TextFieldToTextView branch works for you. In the example, this is the line where I assign an UITextView as nextNavigationField of an UITextField.

Idomo commented

@T-Pham Now when I'm thinking about it, I did this in the didSet property observer, So maybe that was the problem.
But it's still weird that it worked with UITextField and not with UITextView , maybe they are loading at different times(?)

Can you share the code? It's hard to say without the code.

Idomo commented

@T-Pham

@IBOutlet weak var myTextView: UITextView!
@IBOutlet weak var myTextField: UITextField!{
  didSet{
    myTextField.nextNavigationField = myTextView
  }
}

@Idomo I can reproduce the issue now. When myTextField didSet is called, myTextView is still nil as it is not loaded from the nib yet.
I don't think we can "fix" this in the lib. Anyway, this doesn't seem to be a typical use case. Why don't you connect the nextNavigationField in the interface builder?

Idomo commented

At the end I did it via the storyboard, just wanted to let you know about this issue and if you can fix it.
Thanks.