In a unit test I am trying to call becomeFirstResponder method on a UITextField, but I am getting NO i.e. its not becoming the first responder.
The code looks as below:
UITextField *textField = [self.controller.searchBar valueForKey: @"_searchField"];
// textField = [[UITextField alloc] initWithFrame:CGRectMake(10.0, 10.0, 400.0, 44.0)];
[self.navigationController.navigationBar addSubview:textField];
textField.enabled = YES;
STAssertTrue([textField becomeFirstResponder],
@"TextField should be a first responder.");
Am I missing something here?