MapKit and touch events problem

Discussion in 'iOS Programming' started by Kingbombs, Aug 30, 2009.

  1. Kingbombs macrumors member

    Joined:
    Jun 24, 2009
    #1
    So I'm using mapkit at the moment to display some google maps

    I want to allow user interaction (touchesBegan method etc)
    Problem is once i add the the mapView as a subview it doesn't recognize any touch events

    i have:
    Code:
    mapView=[[MKMapView alloc] initWithFrame:self.view.frame];
    	//mapView.showsUserLocation=TRUE;
    	[mapView setUserInteractionEnabled:YES];
    	mapView.mapType=MKMapTypeHybrid;
    	mapView.delegate=self;
    	[self.view insertSubview:mapView atIndex:0];
    
    ;

    I just tried setUserInteractionEnabled:YES
    But that doesn't make any difference
    I'm guessing I'm missing something pretty important to add touch events to the sub view?

    any help would be useful! thank you

    PS: i want to do this with the map still allowing its old touches (pinch to zoom and drag to move map) i just wan to tap the screen once and record that information
     
  2. KoolStar macrumors demi-god

    KoolStar

    Joined:
    Oct 16, 2006
    Location:
    Kentucky
    #2
    When a map view is used the touch events are handled by the mapviewcontroller, they are not handled by the uiview that the mapview is located on.
     

Share This Page