I am trying to use a customized keyboard in my application, but I am hitting problems when trying to restrict it to one particular UITextField.
I based my code on this X
You can write a UIView category method to find the first responder.
- (UIView *)firstResponder
{
if ([self isFirstResponder])
{
return self;
}
for (UIView *view in self.subviews)
{
UIView *firstResponder= [view firstResponder];
if (firstResponder)
{
return firstResponder;
}
}
return nil;
}
Then in your - (void)keyboardWillShow:(NSNotification *)notification
method you can use it like this
UITextField *textField = (UITextField *)[self firstResponder];