Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I found out the answer <a href="https://devforums.apple.com/message/154834#154834" rel="nofollow noreferrer">here</a>(Apple Developer Forum).</p> <p>Keith at Apple Developer Technical Support, on 18th May 2010 (iPhone OS 3):</p> <blockquote> <p>I recommend that you avoid having touch-sensitive UI in such close proximity to the nav bar or toolbar. These areas are typically known as "slop factors" making it easier for users to perform touch events on buttons without the difficulty of performing precision touches. This is also the case for UIButtons for example.</p> <p>But if you want to capture the touch event before the navigation bar or toolbar receives it, you can subclass UIWindow and override: -(void)sendEvent:(UIEvent *)event;</p> </blockquote> <p>Also I found out,that when I touch the area under the UINavigationBar, the location.y defined as 64,though it was not. So I made this:</p> <p>CustomWindow.h</p> <pre><code>@interface CustomWindow: UIWindow @end </code></pre> <p>CustomWindow.m</p> <pre><code>@implementation CustomWindow - (void) sendEvent:(UIEvent *)event { BOOL flag = YES; switch ([event type]) { case UIEventTypeTouches: //[self catchUIEventTypeTouches: event]; perform if you need to do something with event for (UITouch *touch in [event allTouches]) { if ([touch phase] == UITouchPhaseBegan) { for (int i=0; i&lt;[self.subviews count]; i++) { //GET THE FINGER LOCATION ON THE SCREEN CGPoint location = [touch locationInView:[self.subviews objectAtIndex:i]]; //REPORT THE TOUCH NSLog(@"[%@] touchesBegan (%i,%i)", [[self.subviews objectAtIndex:i] class],(NSInteger) location.x, (NSInteger) location.y); if (((NSInteger)location.y) == 64) { flag = NO; } } } } break; default: break; } if(!flag) return; //to do nothing /*IMPORTANT*/[super sendEvent:(UIEvent *)event];/*IMPORTANT*/ } @end </code></pre> <p>In AppDelegate class I use CustomWindow instead of UIWindow.</p> <p>Now when I touch area under navigation bar, nothing happens. </p> <p>My buttons still don't get touch events,because I don't know how to send this event (and change coordinates) to my view with buttons.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload