首先, 键盘,statuBar都属于独立的window,而非view
其次,
UIWindow
继承自UIView
最后,最上层的
UIView
会拦截处于下方的其他view的触摸事件。
所以我的问题是,为什么在有statusBar和键盘的时候还是不影响操作其它可见的控件呢?特别是键盘,貌似它的window尺寸是占满了整个屏幕的。
突然想到,随手一问,谢谢
你也可以做到
@interface KeyboardWindow : UIWindow
@property (nonatomic, strong) UIView *keyboardView;
@end
@implementation
- (UIView*)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
if (CGRectContainsPoint(self.keyboardView.frame, point))
return [self.keyboardView hitTest:[self convertPoint:point toView:self.keyboardView]
withEvent:event];
return nil;
}
@end