1
我正在使用MKMapView的visibleMapRect属性来设置我的应用程序中可见区域的边界。但由于某些原因,该地图的MKMapRect值是不同的MKMapView的visibleMapRect属性没有正确设置地图区域?
//setting the bounds
MKMapRect bounds = MKMapRectMake(x, y, width, height);
[map setVisibleMapRect:bounds];
- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated{
MKMapRect mpRect = [mapView visibleMapRect];
NSLog(@"Origin: %f, %f", mpRect.origin.x, mpRect.origin.y);
NSLog(@"Size: %f, %f", mpRect.size.width, mpRect.size.height);
}
通过的MapView打印的值:regionDidChangeAnimated:方法是从我设置了不同的。
我该如何改变这一点,并确保我设置的visibleRect是真正可见的?
谢谢。