I have a custom UIView that implements the UIKeyInput protocol and has
- (BOOL) canBecomeFirstResponder{
return YES;
}
defined in the subclass. When calling:
[customView becomeFirstResponder];
NSLog(@"is first? %i",[customView isFirstResponder]);
during a button click, it returns false, even though canBecomeFirstResponder is properly set and all of the UIKeyInput protocol functions are implemented. What other things could be blocking this view from becoming the first responder? It lives inside of a scrollView and another custom view if that helps.
Update:
I checked to see what the current first responder was with:
UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow];
UIView *firstResponder = [keyWindow performSelector:@selector(firstResponder)];
and surprisingly firstResponder was nil. So nothing seems to be hogging the events.
Did you override
becomeFirstResponder?Followup:
Did you verify you meet all of the above conditions?