Skip to content

Instantly share code, notes, and snippets.

@taktamur
Created August 16, 2014 09:30
Show Gist options
  • Save taktamur/eabe5ca9f8f4aeb9314a to your computer and use it in GitHub Desktop.
Save taktamur/eabe5ca9f8f4aeb9314a to your computer and use it in GitHub Desktop.
メモ:UINavigationBarの当たり判定が下にはみ出す、その理由 ref: http://qiita.com/paming/items/ab582d5c1d61794e7433
@interface HitTestNavigationBar : UINavigationBar
@end
@implementation HitTestNavigationBar
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
NSLog( @"hitTest point.y=%.1f",point.y);
if ([self pointInside:point withEvent:event]) {
self.userInteractionEnabled = YES;
} else {
self.userInteractionEnabled = NO;
}
UIView *view = [super hitTest:point withEvent:event];
return view;
}
@end
2014-08-16 18:07:23.846 HitTest[79584:60b] hitTest point.y=37.0 // NavigationBarの中でタップ、1度目
2014-08-16 18:07:23.849 HitTest[79584:60b] hitTest point.y=37.0 // NavigationBarの中でタップ、2度目
2014-08-16 18:07:26.692 HitTest[79584:60b] hitTest point.y=49.5 // NavigationBarの外でタップ、1度目
2014-08-16 18:07:26.693 HitTest[79584:60b] hitTest point.y=49.5 // NavigationBarの外でタップ、2度目
2014-08-16 18:09:52.293 HitTest[79743:60b] hitTest point.y=37.0 // NavigationBarの中でタップ、1度目
2014-08-16 18:09:52.296 HitTest[79743:60b] hitTest point.y=37.0 // NavigationBarの中でタップ、2度目
2014-08-16 18:09:56.658 HitTest[79743:60b] hitTest point.y=49.0 // (A)NavigationBarの外でタップ、1度目
2014-08-16 18:09:56.659 HitTest[79743:60b] hitTest point.y=34.0 // (B)NavigationBarの外でタップ、2度目
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment