0

I am using map view in my iOS app. After the user scrolls the map and lifts his finger I need to send web service request to get new data and then I want to plot that lat longs.

Here I want to detect touch end event on map view. Also same time want to handle web service request and response. I tried using tap gesture but not getting proper result.

Please suggest something

Thanks

WrightsCS
  • 50,551
  • 22
  • 134
  • 186
Swapnil
  • 1,858
  • 2
  • 22
  • 49
  • possible duplicate of [How to intercept touches events on a MKMapView or UIWebView objects?](http://stackoverflow.com/questions/1049889/how-to-intercept-touches-events-on-a-mkmapview-or-uiwebview-objects) – Abizern Dec 22 '11 at 08:58

1 Answers1

0

You need to set the delegate of the map view, then implement this method:

– mapView:regionDidChangeAnimated:

This gets called everytime the user has finished scrolling.

For the HTTP request I suggest using ASI. Its really easy to use....

- (void) grabURLInBackground:(id)sender
{
   NSURL *url = [NSURL URLWithString:@"http://allseeing-i.com"];
   ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
   [request setDelegate:self];
   [request startAsynchronous];
}

- (void)requestFinished:(ASIHTTPRequest *)request
{
   // Use when fetching text data
   NSString *responseString = [request responseString];

   // Use when fetching binary data
   NSData *responseData = [request responseData];
}

- (void)requestFailed:(ASIHTTPRequest *)request
{
   NSError *error = [request error];
}
Robert
  • 37,670
  • 37
  • 171
  • 213