I have a view controller. It is pushed by another's UINavigationController
.
In ViewController.m:
- (BOOL)canBecomeFirstResponder {
return YES;
}
- (void)viewDidAppear:(BOOL)animated {
[self.view becomeFirstResponder];
NSLog(@"%d", [self.view isFirstResponder]);
[super viewDidAppear:animated];
}
It's always 0. Why?
Your view has to accept first responder status. This is implemented in your view's subclass code, you have to override canBecomeFirstResponder
and return YES:
- (BOOL)canBecomeFirstResponder
{
return YES;
}