4

When touches on the keyboard area, the root view's method be triggered:

  • (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event

I am very confused,anyone can help me?

BaeCheung
  • 41
  • 2
  • I faced with the same at first. Also I found that this problem arises only on iPhone (iPod touch with iOS8 works fine!). Then I recompilled project again on xCode6 (it seems that nothing changed at all) but the problem vanished suddenly. I can't reconstruct this problem again. The only difference between my efforts is the change of the provisional profile. – malex Sep 22 '14 at 10:02
  • I also have the same problem. It's happening only on iOS 7 binaries running on iOS 8. Also, the app needs to enter background and return to the foreground for the problem to occur. The problem arises also on iPad so I doubt it's hardware specific. – Antoine Lamy Sep 22 '14 at 17:04
  • 1
    This [old question][1] might be useful. [1]: http://stackoverflow.com/questions/8072984/hittest-fires-when-uikeyboard-is-tapped – Antoine Lamy Sep 22 '14 at 17:49
  • thanks very much! This can be used as temporary solution。@Antoine Lamy – BaeCheung Sep 23 '14 at 05:04

2 Answers2

2

In your applicationWillEnterForeground in AppDelegate, put this code. It works for me, specially with KLCPopup

- (void)applicationWillEnterForeground:(UIApplication *)application{
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.

if (!IS_OS_8_OR_LATER) return;
[UIApplication.sharedApplication.windows enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(UIWindow *w, NSUInteger idx, BOOL *stop) {
    if (!w.opaque && [NSStringFromClass(w.class) hasPrefix:@"UIText"]) {
        // The keyboard sometimes disables interaction. This brings it back to normal.
        BOOL wasHidden = w.hidden;
        w.hidden = YES;
        w.hidden = wasHidden;
        *stop = YES;
    }
}];}
Cœur
  • 37,241
  • 25
  • 195
  • 267
Atef
  • 2,872
  • 1
  • 36
  • 32
0

This problem will appear in:

1、you changed keywindow‘s rootViewController;

2、enter background and return to the foreground;

So,restore UITextEffectsWindow can fixed it after your change everytime.

void TSRestoreKeyboardWindow(void)
{
    if (!TSSystemVersionGreaterThanIOS8()) return;
    [UIApplication.sharedApplication.windows enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(UIWindow *w, NSUInteger idx, BOOL *stop) {
        if (!w.opaque && [NSStringFromClass(w.class) hasPrefix:@"UIText"]) {
            // The keyboard sometimes disables interaction. This brings it back to normal.
            BOOL wasHidden = w.hidden;
            w.hidden = YES;
            w.hidden = wasHidden;
            *stop = YES;
        }
    }];
}
BaeCheung
  • 41
  • 2