title: Keyboard intermittently disappears when editing using IOS 8
body: <p>I had several cases where testers reported that the keyboard would disappear whenever they started typing in some fields in my app. I traced the flow using the simulator and while debugging on a phone and the problem didn't occur, ever. However, when I tried it on an untethered phone it happened fairly consistently.</p>
  
  <p>Here's some pertinent code. All of this is to hide the keyboard when a user taps outside a textfield. My UIViews are subclasses of my Touchview class, which receives all touches:</p>
  
  <p>TouchView.h:</p>
  
  <pre><code>@protocol TouchViewDelegate &lt;NSObject&gt;
  
  -(UIView *) handleTouches:(NSSet *)touches withEvent:(UIEvent *)event inView:(UIView *) view;
  
  @end
  
  @interface TouchView : UIScrollView
  
  @property (nonatomic, strong) id &lt;TouchViewDelegate&gt; touchDelegate;
  
  @end
  </code></pre>
  
  <p>TouchView.m:</p>
  
  <pre><code>- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
      UIView * touchedView = [super hitTest:point withEvent:event];
      NSSet* touches = [event allTouches];
      [self.touchDelegate handleTouches:touches withEvent:event inView:touchedView];
      return touchedView;
  </code></pre>
  
  <p>}</p>
  
  <p>I configured the main view as a Touchview and included this in the viewDidLoad:</p>
  
  <pre><code>- (void)viewDidLoad
  {
  [super viewDidLoad];
  
  HMWTouchView * touchView = (HMWTouchView*) self.view;
  
  touchView.touchDelegate = self;
  ...
  }
  </code></pre>
  
  <p>Here's an implementation of the delegate method:</p>
  
  <pre><code>-(UIView *) handleTouches:(NSSet *)touches withEvent:(UIEvent *)event inView:(UIView *) hitView {
  
  if (![hitView isKindOfClass:[UIButton class]]) {
      [[UIResponder firstResponder] resignFirstResponder];
  }
  return self.view;
  }
  </code></pre>
  
  <p>This looks like it is at least a change in how IOS 8 responds to hits.</p>