5

I have a UIView which draws a signature. The signature is inputed via a custom inputView on the signature view. When drawing the signature view, I use the fact that it's the first responder to highlight the view as being edited, and I also override the resignFirstResponder method to work out when to stop showing it as being edited.

So the code looks something like this:

@implementation SignatureView 

-(BOOL) becomeFirstResponder {
    BOOL result = [super becomeFirstResponder];
    [self showEditingMode];
    return result;
}

-(BOOL) resignFirstResponder {
    BOOL result = [super resignFirstResponder];
    [self showViewingMode];
    return result;
}

-(UIView *) inputView {
    if (!keyboard)
      keyboard = [[SignatureKeyboardView alloc] initWithStuff:stuff....];
    return keyboard;
}

@end

The problem I'm having is that on iOS 11, the resignFirstResponder method is no longer getting called. On previous versions of iOS, it used to get called and I could then change the UI to show that it's no longer being edited.

This ONLY HAPPENS when the UIScrollView is set to dismiss the keyboard when dragged, and the user drags the UIScrollView. If the user instead taps another UIView that can become a first responder e.g. a UITextField, then resignFirstResponder gets called.

Am I missing something that changed in iOS11 or have I hit a bug?

Kuldeep
  • 4,466
  • 8
  • 32
  • 59
Mof
  • 363
  • 3
  • 9
  • @molf where you able to resolve this issue – salabaha Mar 04 '21 at 18:11
  • Hey @salabaha - no I never was able to work it out. I ended up working around it by listening to UIKeyboardWillShowNotification and UIKeyboardWillHideNotification and then doing what I need to do. Not ideal but it works. – Mof Mar 06 '21 at 00:42
  • Thanks for response. I did made the same workaround by subscribing to Keyboard notifications and it worked for. – salabaha Mar 08 '21 at 10:32

0 Answers0