我使用MKMapView的visibleMapRect属性来设置应用程序中可见区域的边界。但由于某种原因,地图的MKMapRect值是不同的
//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的内容真正可见?
感谢。
答案 0 :(得分:0)
我想这是因为你的MKMapView的宽高比与你的MKMapRect的比例不同,但没有进一步的信息很难说。
您能提供您尝试设置的MapRect的日志以及要返回的日志吗?