0

I want to focus my UITextfield in my bottom toolbar, so on ViewWillAppear I wrote the following code:

textBarcode.BecomeFirstResponder ();

But the textBarcode doesn't become the focus. I also tried it with a little bit of a delay, but got the same result.

Does anybody have any ideas?

qJake
  • 16,821
  • 17
  • 83
  • 135
anguish
  • 458
  • 1
  • 7
  • 27

3 Answers3

1
- (void)viewWillAppear:(BOOL)animated
{
    textBarcode.delegate = self;

    [textBarcode becomeFirstResponder];
}
Bhavesh Nayi
  • 3,626
  • 1
  • 27
  • 42
1

Check that isUserInteraction field is set to true.

textField.isUserInteractionEnabled = true
textField.becomeFirstResponder()
Vadim Ahmerov
  • 708
  • 9
  • 12
0

You write this in viewDidAppear

[textBarcode becomeFirstResponder];
Toseef Khilji
  • 17,192
  • 12
  • 80
  • 121