Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

regionDidChangeAnimated not (always) firing

Leon223Leon223 Posts: 3New Users
edited February 2012 in iOS SDK Development
I've got a MKMapView which is loaded in the file 'MapView.m'. Initially the regionDidChangeAnimated delegate method is working fine, whenever i drag the map the delegate is being called (the delegate is being set).

On the map i am drawing Custom Annotations with the method:
- (MKAnnotationView *) mapView: (MKMapView *) mapView viewForAnnotation: (id<MKAnnotation>) annotation

The MKAnnotationView is in my case a custom view which inherits from MKAnnotationView. Within this custom view i am using this methode to check if a toch event appeared:
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;

When a click appears the following code is getting executed:
AnnotationInformation * annotationInfo = [[AnnotationInformation alloc] initWithNibName:@"AnnotationInformation" bundle:nil]; annotationInfo.selectedPoi = poi; annotationInfo.view.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height); [appDelegate.controller pushViewController:annotationInfo animated:YES];

When i hit back and return to the mapview the MKMapview delegate stops responding, or at least, it does not respond that often anymore.

Any change i missed something?
Post edited by Leon223 on
· ·

Replies

  • Leon223Leon223 Posts: 3New Users
    edited May 2011
    none?
    · ·
  • pgDeveloperpgDeveloper Posts: 1New Users
    edited June 2011
    Leon223 wrote: »
    none?

    I had the same problem, it was solved by adding a call to the base class touchesEnded
    [super touchesEnded:touches withEvent:event];
    in the annotation view
    · ·
  • ZoolZool Posts: 21Registered Users
    edited June 2011
    You probably figured it out by now, but this happens because your customized callout is intercepting touchevents and not returning MKMapView from HitTest. You need to implement
    - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
    

    from your customized MKAnnotationView and return your MKMapView so it can resume processing touch events.
    · ·
  • BrendanFBrendanF Posts: 86Registered Users
    edited February 2012
    Zool wrote: »
    You probably figured it out by now, but this happens because your customized callout is intercepting touchevents and not returning MKMapView from HitTest. You need to implement
    - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
    

    from your customized MKAnnotationView and return your MKMapView so it can resume processing touch events.

    I am having this same issue. When I added the above code to return my MKMapView in my custom MKAnnotationView the map would stop responding to pans entirely.
    · ·
Sign In or Register to comment.