Tôi muốn đặt một vùng trên MKMapView và sau đó tìm tọa độ tương ứng với góc NE và SW của bản đồ.Làm cách nào để biết khi nào MKMapview setRegion: hoạt ảnh: đã hoàn tất?
This code works just fine to do that:
//Recenter and zoom map in on search location
MKCoordinateRegion region = {{0.0f, 0.0f}, {0.0f, 0.0f}};
region.center = mySearchLocation.searchLocation.coordinate;
region.span.longitudeDelta = 0.01f;
region.span.latitudeDelta = 0.01f;
[self.mapView setRegion:region animated:NO]; //When this is set to YES it seems to break the coordinate calculation because the map is in motion
//After the new search location has been added to the map, and the map zoomed, we need to update the search bounds
//First we need to calculate the corners of the map so we get the points
CGPoint nePoint = CGPointMake(self.mapView.bounds.origin.x + mapView.bounds.size.width, mapView.bounds.origin.y);
CGPoint swPoint = CGPointMake((self.mapView.bounds.origin.x), (mapView.bounds.origin.y + mapView.bounds.size.height));
//Then transform those point into lat,lng values
CLLocationCoordinate2D neCoord;
neCoord = [mapView convertPoint:nePoint toCoordinateFromView:mapView];
CLLocation *neLocation = [[CLLocation alloc] initWithLatitude:neCoord.latitude longitude:neCoord.longitude];
CLLocationCoordinate2D swCoord;
swCoord = [mapView convertPoint:swPoint toCoordinateFromView:mapView];
CLLocation *swLocation = [[CLLocation alloc] initWithLatitude:swCoord.latitude longitude:swCoord.longitude];
Vấn đề là tôi muốn thu phóng bản đồ được làm động. Tuy nhiên, khi tôi đặt setRegion: animated thành YES, tôi sẽ nhận được tọa độ từ bản đồ khi nó được phóng to ra (tức là, trước khi hoạt ảnh được hoàn thành). Có cách nào để có được một tín hiệu rằng các hình ảnh động được thực hiện?
ngốc tôi, đó là trong giao thức đại biểu không phải là MKMapView riêng của mình. Tôi biết tôi đã nhìn thấy nó ở đâu đó ... cảm ơn: D – deadroxy